munificent/hauberk

RNG

Closed this issue · 2 comments

Hello there,
how does rng.oneIn(x) work exactly? Could some1 describe it?

Hey there,

It's documented here => https://github.com/munificent/piecemeal/blob/master/lib/src/rng.dart

Apart from that, can't help much =)

@Mudshovel is right. More specifically: https://github.com/munificent/piecemeal/blob/master/lib/src/rng.dart#L95

It returns true 1/x of the time. So oneIn(3) returns true a third of the time and false otherwise.