random
Generates a random integer number. Biggest range (from lower to upper boundary) is 2^31-1.
Vectorization: This function supports vectorization. Sets and nested sets containing numeric values are also supported.
Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter
1, 2
| No. | Type | Description |
|---|---|---|
| 1. input |
numeral set |
1st boundary value If specified alone, then random numbers returned lie between 0 and specified value. Multiple values can be provided in a set for vectorization. |
| Opt. 2. input |
numeral set |
2nd boundary value If specified, then it will serve as 2nd boundary value. It does not matter if it is smaller or greater than the 1st boundary value. Multiple values can be provided in a set for vectorization. |
| Type | Description |
|---|---|
| numeral set |
Random number Randomly generated number(s) |
Values provided is not a numerals
for (i[]=1, i[]<=10, i[]++) print( random(1000), " " ); echo;
for (i[]=1, i[]<=10, i[]++) print( random( 1000, 950), " " ); echo;
for (i[]=1, i[]<=10, i[]++) print( random(-1000, -950), " " ); echo;
for (i[]=1, i[]<=10, i[]++) print( random( -5, 3), " " ); echo;
for (i[]=1, i[]<=10, i[]++) print( random( -1, 1), " " ); echo;
echo;
echo("Vectorization exmaple: ", random({10:1000}) ); // Provide 10 random numbers.648 505 96 171 895 884 867 901 141 298
957 978 978 993 984 989 969 952 986 955
-951 -977 -971 -980 -995 -950 -954 -984 -975 -990
-4 -5 -2 -2 -2 1 -1 -2 -2 -4
1 0 0 1 1 1 0 -1 -1 -1
Vectorization exmaple: {313,78,602,610,407,676,94,481,521,679}