| Roll | ? 0 0 0 | Deal |
|
? y yields a uniform random selection from the
population i.y if y is a positive integer, or from
the interval of numbers greater than 0 and less than 1
if y is 0. The random seed used begins
at 7^5 (16807).
|
x ? y is a list of x items randomly chosen
without repetition from i.y .
|
? 6
0
? 6 6 6 6 6 6 6 6
0 5 5 4 2 3 2 1
6 ? 6 NB. A random permutation
0 1 5 4 3 2
mean=: +/ % #
mean ? 1000 # 6
2.459
] m=: ? 4 4 $ 9 NB. A random matrix for experimentation
3 8 8 4
2 0 2 7
4 2 3 5
1 1 7 2
-/ . * m NB. The determinant of m
_659
f=: ?@$ % ] - 1:
3 6 f 9 NB. Random 3 by 6 table in range zero to one with resolution 9
0.375 1 1 0.5 0.25 0
0.25 0.875 0.5 0.25 0.375 0.625
0.125 0.125 0.875 0.25 0.875 0.75
? 2 1 $ !38x
202466594106002578660243928542852207957556146
79605116563118621090926071782092415123181713
Several instances of the foreign conjunction are provided to work with random numbers. 9!:(2*n) queries a parameter and 9!:(1+2*n) sets it.
| 9!:42 y 9!:43 y |
RNG Select. Select the random number generator
“Speed” is the time for generating one million U(0,1) numbers, with 1.0 being the fastest. ? uses Mersenne Twister as the default RNG. ?. uses GB_Flip as the fixed RNG. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9!:44 y 9!:45 y |
RNG State.
The sequence of random numbers generated by an RNG depends
completely on the state.
The state is a boxed vector whose interpretation depends on the
particular RNG. For example:
t=: 9!:44 '' NB. query the RNG state 5 ?@$ 10000 8590 6147 5158 4729 3522 2 4 ?@$ 10 2 5 5 5 3 8 0 0 9!:45 t NB. set the RNG state 5 ?@$ 10000 8590 6147 5158 4729 3522 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9!:0 y 9!:1 y |
Random Seed.
Queries and sets the random seed used in random number generation.
The initial value is 7^5 .
The seed may be a single integer or (for the Mersenne Twister RNG)
a list of integers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128!:4 y | RNG Raw. Produces y integers as generated directly by an RNG, used typically for debugging the RNG. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||