Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random Numbers Back In To The Pool

Status
Not open for further replies.

Grunta

Technical User
Jul 25, 2006
1
AU
Hey Guys,

Have created some code below, the problem is that I would like to re-insert the numbers back in to the pool, with the possiblity that the same number could occur in all the draws... Any help would be appreciated eh....
Thanks,
Grunta

$start = 1;
$end = 5;
$draws = 5;

$nums=range($start,$end);
print 'All Numbers &quot;ARE&quot; Back in Pool <br>Pool Numbers Range from ' . $start . ' to ' . $end . ' with ' . $draws . ' draws allocated<br> And the Number(s) are as follow.......<br>';

shuffle ($nums);

for ($count=0;$count<$draws;$count++)
{
print '' . $nums[$count] . '<br>';
}
 
i'm not really sure i understood what you were looking for but my code to do that is totally different !!

mt_srand ((double) microtime() * 10000000);
$a_random_one=mt_srand(0, 5)

taht will return a random integer between 0 and 5 (so the same number can occur everytime ... or sometimes ... or never ...)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top