On Saturday 06 December 2003 10:39 pm, TheHeadSage wrote:
Hey,
I've got a script which used to generate a random quote. It worked fine
untill this problem occurred..
Say we have 4 quotes with QuoteID's of 1 through to 4
The script would grab a number of rows, and generate a random number
Hey,
I've got a script which used to generate a random quote. It worked fine
untill this problem occurred..
Say we have 4 quotes with QuoteID's of 1 through to 4
The script would grab a number of rows, and generate a random number
between 1 and this value (being 4 in this case) This worked fine
07, 2003 2:39 PM
Subject: [PHP] Random Numbers..
Hey,
I've got a script which used to generate a random quote. It worked fine
untill this problem occurred..
Say we have 4 quotes with QuoteID's of 1 through to 4
The script would grab a number of rows, and generate a random number
between 1
Hi Tamas,
/* srand is not important since php v=4.2.0 */
$numbers = range (1,90);
$x = array_rand ($numbers, 5);
foreach ($x as $v) echo {$numbers[$v]} ;
It works fine, except the first query: php may restart
the random numbers, if it is not used for some seconds.
I'm not sure how to
Jon!
?php
for ($i=1; $i=6; $i++)
$x[] = mt_rand(1, 90);
foreach ($x as $current)
echo $current. br /;
?
Thanks for help, but your program may generate same numbers between
the 5 generated numbers, hovewer I want to generate different numbers
such as lottery-numbers. array_rand() is a
Hi Tamas,
?php
for ($i=1; $i=6; $i++)
$x[] = mt_rand(1, 90);
foreach ($x as $current)
echo $current. br /;
?
Thanks for help, but your program may generate same numbers between
the 5 generated numbers, hovewer I want to generate different numbers
such as lottery-numbers.
Hi!
I'm using the following method to generate 5 random lottery
numbers:
/* srand is not important since php v=4.2.0 */
$numbers = range (1,90);
$x = array_rand ($numbers, 5);
foreach ($x as $v) echo {$numbers[$v]} ;
It works fine, except the first query: php may restart the random
numbers, if
I'm wondering if random numbers in a cronned script would be anywhere
near random (I know that rand() isn't true random, but I don't want
every number to be the same...)? Since the number is seeded from
time... and cron runs by time...
--
PHP General Mailing List (http://www.php.net/)
To
Hi !
I'm having troubles with the random numbers. When I create a number witm mt_rand()
I always get the same number on my local server. I need this stuff to ranomly display
some text, and I'd like to have another value of the random number each time the
page is refreshed.
Thanks
Nikola
9 matches
Mail list logo