Unbias a random generator: Difference between revisions
→{{header|GAP}}: seems it was not obvious
(→{{header|GAP}}: Marked incomplete. Full range not used. (After deciphering what output is given).) |
(→{{header|GAP}}: seems it was not obvious) |
||
Line 117:
=={{header|GAP}}==
<lang gap>RandNGen := function(n)
local v, rand;
Line 144 ⟶ 143:
end;
# Some tests (2 is added as a witness, since in this case RandN is already unbiased)
▲Sum([1 .. 1000000], n -> a());
PrintArray(TransposedMat([range, List(v, apply), List(w, apply)]));
# [ [ 2, 499991, 499041 ],
# [ 3, 333310, 500044 ],
# [ 4, 249851, 500663 ],
# [ 5, 200532, 500448 ],
# [ 6, 166746, 499859 ] ]</lang>
=={{header|J}}==
|