Generate random numbers without repeating a value: Difference between revisions
Content added Content deleted
(→{{header|jq}}: simplify) |
|||
Line 196: | Line 196: | ||
p; |
p; |
||
# Output: a stream |
|||
def prn_without_repetitions: |
def prn_without_repetitions: |
||
. as $n |
. as $n |
||
| foreach range(0;$n) as $i ([]; |
| foreach range(0;$n) as $i ([]; |
||
. as $exceptions |
. as $exceptions |
||
| |
| . + [$n|prn($exceptions)]; |
||
else . + [($n|prn($exceptions))] |
|||
end; |
|||
.[-1]); |
.[-1]); |
||
Line 230: | Line 229: | ||
14 |
14 |
||
</pre> |
</pre> |
||
=={{header|Julia}}== |
=={{header|Julia}}== |