\S [n]
Where n is
0N: display the current value of the random seed (since V3.6)nNote that \S displays the last value to which the seed was initialized: it is not updated as the
random-number generator (rng) is used.
q)\S / default
-314159i
q)5?10
8 1 9 5 4
q)5?10
6 6 1 8 5
q)\S -314159 / restore default seed
q)5?10 / same random numbers generated
8 1 9 5 4
q)\S / seed is not updated
-314159
q)x:system "S 0N" / current value of seed
q)r:10?10
q)system "S ",string x / re-initialize seed
q)r~10?10
1b
Allows user to save and restore state of the rng. (Since V3.6 2017.09.26.)
q)x:system"S 0N";r:10?10;system"S ",string x;r~10?10