From http://rosettacode.org/wiki/Unbias_a_random_generator
biased=: 0 = ?
unbiased=: i.@# { ::$: 2 | 0 3 -.~ _2 #.\ 4&* biased@# ]
unbias&.> 100#6
|length error
I see only one verb that can be generating a length error, but just to be sure:
unb1=: 4&* biased@# ]
unb2=: _2 #.\ unb1
unb3=: 0 3 -.~ unb2
unb4=: 2 | unb3
unb=: i.@# { ::$: unb4
unb&.> 1000#6
The length error occurs in unb, which means that :: sometimes fails to
trap the error.
9!:14''
j602/2008-03-03/16:45
I get the same error in j7
9!:14''
j701/2011-01-10/11:25
FYI,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm