chickadee » math » random-bits

random-bits numprocedure
num
integer

Returns a random natural smaller than (expt 2 num); num must be positive. For powers of two, this is faster than using random-natural, which is implemented in terms of random-bits, using biased rejection sampling.