note 54433 deleted from function.rand by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: Corry Gellatly ncl.ac.uk 

----

I've used this script to generate an array of random numbers with a numeric key. I got an array of over 200,000 on this system, and got <1000 using the examples submitted previously. I haven't managed to return the array variable outside the function, but have written it to a database.

<?php
function rand_array($start, $end, $rangemin, $rangemax)
{
$array = array_fill($start, $end, 1);

	foreach($array as $key => $value)
		{
		$value = rand($rangemin,$rangemax);
		print "$key: $value<br>\n";
		}
}

$start = 1;
$end = 1000;
$rangemin = 1;
$rangemax = 20000;

rand_array($start, $end, $rangemin, $rangemax);
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.