12-05-2009, 01:51 PM
|
#3 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,381
Thanks: 5
|
Quote:
Originally Posted by cachepl0x
I need this translated, please. Any takers?
|
PHP Code:
// Example:
my_rand(2000);
function my_rand($n) {
$max = 10000000;
$nums = array();
// Generate set of random numbers between 0 and $max (inclusive)
for($i = 0; $i < $n; $i++) {
$nums[] = mt_rand(0, $max);
}
// Sort in ascending numerical order
sort($nums, SORT_NUMERIC);
// Output the numbers
foreach ($nums as $num) {
echo $num . "\n";
}
}
|
|
|
|