random-bits* ( numbits rnd -- n )


Vocabulary
random

Inputs
numbitsan object
rndan object


Outputs
nan object


Definition


:: random-bits* ( numbits rnd -- n )
numbits 32 > [
rnd random-32* numbits 32 -
[ dup 32 > ]
[ [ 32 shift rnd random-32* + ] [ 32 - ] bi* ] while
[ [ shift ] keep rnd random-32* swap bits + ]
unless-zero
] [ rnd random-32* numbits bits ] if ;