ID: 29507 Updated by: [EMAIL PROTECTED] Reported By: bassfranky at hotmail dot com -Status: Open +Status: Feedback Bug Type: *Math Functions Operating System: Linux PHP Version: Irrelevant New Comment:
Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. Use a better seed or provide a reproduce script. Previous Comments: ------------------------------------------------------------------------ [2004-08-03 16:38:20] bassfranky at hotmail dot com Description: ------------ I use rand(min, max) in a php script in a web page that is working pretty well. But I also use it when this page open another (small) window with another page that call the function rand() too. This is working pretty well except when I reload the parent window and open again the small one, then the rand() function will return exactly the latest number !!! Idem with srand() mt_rand() For exemple on my parent window I click on my button "new" this will open the small window and generate 5 I click again on "new" this will close and then reopen the small window and generate 8 etc . . . and then if I click on new and it'll open the small window and generate for exemple 6 after that I reload the parent window and click again on "new" I will get a 6 again After that if I click again on "new" it 'll be another one but if I reload the parent again, I'll definitely get a 6 again, and so on . . . Reproduce code: --------------- $nb = mysql_num_rows($resultMorceau); if ($nob > 0) { srand(); $hasard = mt_rand(0 , $nb-1); echo hasard; } Expected result: ---------------- I'd like to get a random number even if I reload my parent window frame ! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29507&edit=1