Generate random numbers without repeating a value: Difference between revisions

(→‎{{header|jq}}: simplify)
Line 196:
p;
 
# Output: a stream
def prn_without_repetitions:
. as $n
| foreach range(0;$n) as $i ([];
. as $exceptions
| if. length ==+ [$n then empty|prn($exceptions)];
else . + [($n|prn($exceptions))]
end;
.[-1]);
 
Line 230 ⟶ 229:
14
</pre>
 
 
 
=={{header|Julia}}==
2,442

edits