munificent / hauberk

A web-based roguelike written in Dart.
http://munificent.github.io/hauberk/
Other
2.01k stars 202 forks source link

RNG #56

Closed stychu closed 4 years ago

stychu commented 4 years ago

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

Mudshovel commented 4 years ago

Hey there,

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

Apart from that, can't help much =)

munificent commented 4 years ago

@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.