"Is there a discussion of the quality of the RNG somewhere?" See
http://en.m.wikipedia.org/wiki/Mersenne_twister which discusses J's default RNG. On Thursday, September 25, 2014, Johann Hibschman <[email protected]> wrote: > Hi all, > > For fun, I've been running some statistics for a game with an unusual > rule for rolling dice: if a 6 is rolled, roll again and add the > result, repeating on any subsequent 6s. I wanted to implement this in > J, collecting all the individual rolls (rather than just the sum.) > > It seems like there should be a more clever and elegant way to do > this, but this is what I have: > > NB. Simple roll. > roll0 =: >:@? > > NB. This seems to work, but it's not very clever. > roll =: 3 : 0 > r =. >:?y > if. r=y do. r=. r,(roll y) end. > r > ) > > NB. Attempt at iterating via power. Fails because repeats > NB. signal termination. > roll0^:(6&=)^:(<_) 6 > > NB. Attempt at iterating via agenda. Not even close yet. > NB. ]`(]+$:) @. (=&6) NB. where to stick in the roll? > > This gives what I expect: > > roll"0 ] 10#6 > 6 1 0 > 3 0 0 > 3 0 0 > 2 0 0 > 5 0 0 > 2 0 0 > 6 6 2 > 2 0 0 > 1 0 0 > 6 3 0 > > But is there a better way to do this? Also, are there any known issues > with the RNG? I've not gathered enough statistics to prove it, but the > results look clumpier (more identical values in a row) than I expect. > Now, I know that's a common cognitive bias, so it may just be me, but > is there a discussion of the quality of the RNG somewhere? > > Thanks, > Johann > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Sent from Gmail Mobile ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
