note 70384 deleted from function.mt-srand by bobby

From: Date: Fri, 13 Oct 2006 21:35:26 +0000
Subject: note 70384 deleted from function.mt-srand by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-118516@lists.php.net to get a copy of this message
Note Submitter: dont at spam dot me dot com ---- So, it seems when I seed the random number generator with any even number X, I get the same result as seeding it with X+1... <?php for($i = 0 ; $i < 100 ; $i++){ mt_srand($i); echo mt_rand(0,100)." "; } ?> ... gives me.... 89 89 61 61 12 12 83 83 71 71 5 5 60 60 62 62 19 19 73 73 81 81 15 15 70 70 80 80 44 44 32 32 69 69 39 39 66 66 95 95 100 100 65 65 65 65 96 96 53 53 34 34 87 87 38 38 16 16 16 16 26 26 63 63 23 23 45 45 61 61 58 58 4 4 92 92 86 86 66 66 23 23 71 71 54 54 35 35 81 81 83 83 45 45 15 15 38 38 49 49

« previous php.notes (#118516) next »