|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-03 20:46 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
Description: ------------ rand is not random !!!. Random number repeat every 32768 time :-((( _ 0 _ _ 8512030 _ _ 1 _ _ 5655227 _ _ 2 _ _ 6934082 _ _ 3 _ _ 2293270 _ ....... _ 32768 _ _ 8512030 _ _ 32769 _ _ 5655227 _ _ 32770 _ _ 6934082 _ _ 32771 _ _ 2293270 _ ...... Reproduce code: --------------- echo '<pre>'; for ($i=0; $i<160000; $i++) { $ch01=rand(900000, 9999999); echo " _ $i _ \t _ $ch01 _ \n"; } Expected result: ---------------- ..... realy random number ! Actual result: -------------- _ 0 _ _ 8512030 _ _ 1 _ _ 5655227 _ _ 2 _ _ 6934082 _ _ 3 _ _ 2293270 _ ....... _ 32768 _ _ 8512030 _ _ 32769 _ _ 5655227 _ _ 32770 _ _ 6934082 _ _ 32771 _ _ 2293270 _ ......