[ create a new paste ] login | about

Link: http://codepad.org/cBaGHxFU    [ raw code | output | fork ]

PHP, pasted on Jul 22:
1
2
3
4
5
6
7
8
9
10
11
<?php

function randomGen($min, $max, $quantity) {
    $numbers = range($min, $max);
    shuffle($numbers);
    return array_slice($numbers, 0, $quantity);
}

print_r(randomGen(0,20,20));

?>


Output:
Array
(
    [0] => 12
    [1] => 19
    [2] => 20
    [3] => 14
    [4] => 0
    [5] => 4
    [6] => 7
    [7] => 13
    [8] => 8
    [9] => 2
    [10] => 5
    [11] => 3
    [12] => 16
    [13] => 10
    [14] => 1
    [15] => 18
    [16] => 15
    [17] => 9
    [18] => 6
    [19] => 11
)


Create a new paste based on this one


Comments: