Class BoundRnd

java.lang.Object
io.github.olyutorskii.aletojio.BoundRnd

public class BoundRnd extends Object
Bounded random integer value [0,bound) generator.

Random source is RndInt32.

This implementation uses a fast algorithm(Nearly Divisionless) that does not use a division(/) or remainder(%) but bitmask and right-shift.

Modulo bias removal may consume multiple 32-bit random numbers per one output.

See Also:
  • Constructor Details

  • Method Details

    • next

      public int next()
      Return next bounded random number.
      Returns:
      [0, bound) random number