Roll: Difference between revisions

Jump to navigation Jump to search
39 bytes added ,  19:20, 29 October 2019
m
Miraheze>Marshall
No edit summary
Miraheze>Adám Brudzewsky
Line 16: Line 16:
Each [[scalar]] in the argument to Roll must be a non-negative integer.
Each [[scalar]] in the argument to Roll must be a non-negative integer.


The result of Roll on each number <code>n</code> is either
The result of Roll on each number <source lang=apl inline>n</source> is either
* A real number chosen uniformly at random from between 0 and 1, if n is 0; or
* A real number chosen uniformly at random from between 0 and 1, if n is 0; or
* One of the elements of <code>⍳n</code> chosen uniformly at random, otherwise.
* One of the elements of <source lang=apl inline>⍳n</source> chosen uniformly at random, otherwise.


Because [[Iota]] depends on [[index origin]], Roll depends on index origin unless every number in the argument is 0.
Because [[Iota]] depends on [[index origin]], Roll depends on index origin unless every number in the argument is 0.


The choices made by Roll do not have to be truly random: they may be pseudorandom (generated by a deterministic but difficult to predict algorithm) or taken from the operating system. They way random numbers are generated is controlled by the [[random link]] <source class=apl inline>⎕RL</source>.
The choices made by Roll do not have to be truly random: they may be pseudorandom (generated by a deterministic but difficult to predict algorithm) or taken from the operating system. They way random numbers are generated is controlled by the [[random link]] <source lang=apl inline>⎕RL</source>.


== External links ==
== External links ==

Navigation menu