note 8832 added to rand

From: Date: Sat, 30 Sep 2000 00:28:03 +0000
Subject: note 8832 added to rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-5685@lists.php.net to get a copy of this message
This function seems to have a problem with generating a random number if the min and max values are the same. I tried it with rand(0, 0) just to see, and I received an invalid range error. You'd think that it would just pick 0. This occurred when I was trying tp choose a random value from an array by picking a random number from 0 to sizeof($array) - 1. The array only had one element in it. http://www.php.net/manual/function.rand.php

« previous php.notes (#5685) next »