-
-
Notifications
You must be signed in to change notification settings - Fork 100
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
kaplay's internal RNG is a linear congruential generator, which is known to be trash when you need to generate a random series of numbers, it's almost as bad as RANDU.
the CA example shared below shows some clear repeating diagonal patterns when the simulation stabilizes, which a good RNG would never produce. (and in fact I believe it is the same pattern every time, just shifted, which is even worse.)
Version
No response
Playground Link
Extra information
a better one (I forget where this came from) can be pasted at the bottom of the kaplayground demo:
var seed = +new Date;
function bobrand() {
seed &= 0xffffffff;
seed = (seed + 0x7ed55d16 + (seed << 12)) & 0xffffffff;
seed = (seed ^ 0xc761c23c ^ (seed >>> 19)) & 0xffffffff;
seed = (seed + 0x165667b1 + (seed << 5)) & 0xffffffff;
seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff;
seed = (seed + 0xfd7046c5 + (seed << 3)) & 0xffffffff;
seed = (seed ^ 0xb55a4f09 ^ (seed >>> 16)) & 0xffffffff;
return seed / 0x100000000;
}
function choose(list) {
return list[(bobrand() * list.length) | 0];
}Summary
- Fixed in v4000
- Fixed in v3001
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working