i’m looking at it know… it’s a simple LCPRNG, i think the parameters are copied from a noise generator on aleph. i’d say the seed, params and algo are OK - not crypto-quality but fine for (most) music purposes
the problem is how the random output is mapped to an arbitrary range, this line:
[ https://github.com/monome/aleph/blob/dev/apps/bees/src/ops/op_random.c#L74 ]
it takes a modulo of the LCG output, so effectively uses the least-significant bits; only the last 4 bits in the case you describe. these bits by themselves are decidedly not random - the have obvious cycles as you’ve observed.
a better way would be to take as many bits as are needed starting with the highest.
a still better and more expensive way would be to cast the full output range to float, rescale to the requested range, and cast back to sint16.
the “best” way (in terms of getting a really random distribution) would be to just keep rerolling until you “happen” to get something in the range you requested. of course this won’t work for a realtime application!
oh, and maybe we should have a SEED input anyway… repeatable randomness!
(tagging @tehn just cause it looks like he authored this op. which is not to say that it wasn’t my mistake.)
thanks for pointing it out