View Javadoc
1   /*
2    * License : The MIT License
3    * Copyright(c) 2022 Olyutorskii
4    */
5   
6   package io.github.olyutorskii.aletojio.idling;
7   
8   /**
9    * Monitor whether or not a random number sequence satisfies statistical criteria.
10   */
11  public interface RndMonitor {
12  
13      /**
14       * Reset statistical status.
15       */
16      public abstract void reset();
17  
18      /**
19       * Probe new random value.
20       *
21       * <p>The statistical state of the past random sequence is recalculated.
22       *
23       * <p>Once the statistical condition is met,
24       * it must continue to return true until {@link #reset()} is called.
25       *
26       * @param iVal new random value
27       * @return true if met statistical condition
28       */
29      public abstract boolean probe(int iVal);
30  
31      /**
32       * Inspect statistical condition.
33       *
34       * <p>Must return false immediately after constructor
35       * and {@link #reset()} calls.
36       *
37       * <p>Once {@link #probe(int)} returns true, must continue to return true
38       * until {@link #reset()} called.
39       *
40       * @return true if met statistical condition.
41       */
42      public abstract boolean hasMet();
43  
44  }