View Javadoc
1   /*
2    * License : The MIT License
3    * Copyright(c) 2022 olyutorskii
4    */
5   
6   package io.github.olyutorskii.aletojio.rng;
7   
8   /**
9    * 31bit Random number generator.
10   *
11   * <p>INFO : {@code java.util.random.RandomGenerator#nextInt(int bound)} added since JDK17 or later.
12   *
13   * @see java.util.Random#nextInt(int bound)
14   */
15  public interface RndInt31 {
16  
17      /**
18       * Return next random number as 31bit int from LSB without sign-bit.
19       *
20       * <p>Only positive or zero value returned.
21       *
22       * <p>* LCG implementations on CPU without 64-bit remainders
23       * often output only 31-bit random numbers.
24       *
25       * @return random number
26       */
27      public abstract int nextInt31();
28  
29  }