Random: Difference between revisions
Content added Content deleted
(elaborate on random overloads) |
("Better category ordering, add redirects to categories, fix pseudo-adverb categories") |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{primitive|a?b<br>a?y}} |
{{primitive|a?b<br>a?y}} |
||
''' |
'''random''' takes two values and returns random values based on their types. The named version in K7+ is called '''rand'''. |
||
For the [[monadic]] version, see [[random-float]]. |
|||
When given two integers, generates <code>a</code> random integers in the range <code>!b</code>. |
When given two integers, generates <code>a</code> random integers in the range <code>!b</code>. |
||
Line 26: | Line 28: | ||
"DCE" |
"DCE" |
||
</pre> |
</pre> |
||
[[Category:Verbs]] |
|||
[[Category:Operator verbs]] |
|||
[[Category:Primitives]] |
Latest revision as of 06:42, 9 July 2022
Random
a?b
a?y
a?y
random takes two values and returns random values based on their types. The named version in K7+ is called rand.
For the monadic version, see random-float.
When given two integers, generates a
random integers in the range !b
.
6?5 0 1 1 2 3 2 6?5 0 2 4 1 4 0
When the right argument is an array, makes a
random choices from array y
.
If a
is negative, deals abs a
elements from the array without replacement(no repeats of previously chosen elements).
10?"ABCDE" "ABBCDCACEB" 10?"ABCDE" "EABABDACEA" -3?"ABCDE" "DAE" -3?"ABCDE" "DCE"