View Single Post

   
  #2 (permalink)  
Old 04-29-2008, 08:27 PM
Michael Fesser
 
Posts: n/a
Default Re: Random value with condition

..oO(Cosmic programmer)

>I need to generate a random value from x to y having increment i.
>where x is start value, y is end value.
>
>so if x = 2 and y = 12 and i = 2
>
>then random value should be generated from the following set
>
>(2,4,6,8,10,12)
>
>and if x = 1 then random number should be picked from the following set
>
>(1,3,5,7,9,11)
>
>I need to know both in MySQL and PHP and will choose whichever is simpler.


Read about 'for' loops.

Micha
Reply With Quote