KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > RandomGenerator


1 /*
2  * This file is part of JGAP.
3  *
4  * JGAP offers a dual license model containing the LGPL as well as the MPL.
5  *
6  * For licencing information please see the file license.txt included with JGAP
7  * or have a look at the top of class org.jgap.Chromosome which representatively
8  * includes the JGAP license policy applicable for any file delivered with JGAP.
9  */

10 package org.jgap;
11
12 import java.io.*;
13
14 /**
15  * The RandomGenerator interface provides an abstraction for the random
16  * number implementation so that more rigorous or alternative implementations
17  * can be provided as desired.
18  * <p>
19  * ATTENTION: nextDouble should only return values betwen 0 (inclusive)
20  * and 1 (exclusive!). The same holds for nextFloat.
21  *
22  * @author Neil Rotstan
23  * @author Klaus Meffert
24  * @since 1.0
25  */

26 public interface RandomGenerator
27     extends Serializable {
28   /** String containing the CVS revision. Read out via reflection!*/
29   final static String JavaDoc CVS_REVISION = "$Revision: 1.7 $";
30
31   /**
32    * Returns the next pseudorandom, uniformly distributed int value
33    * from this random number generator's sequence. The general contract
34    * of nextInt is that one int value is pseudorandomly generated and
35    * returned. All 2^32 possible int values are produced with
36    * (approximately) equal probability.
37    *
38    * @return a pseudorandom integer value
39    *
40    * @author Neil Rotstan
41    * @since 1.0
42    */

43   public int nextInt();
44
45   /**
46    * Returns a pseudorandom, uniformly distributed int value between
47    * 0 (inclusive) and the specified value (exclusive), drawn from this
48    * random number generator's sequence. The general contract of nextInt
49    * is that one int value in the specified range is pseudorandomly
50    * generated and returned. All n possible int values are produced with
51    * (approximately) equal probability.
52    * @param a_ceiling the upper boundary excluded
53    *
54    * @return a pseudorandom integer value between 0 and the given
55    * ceiling - 1, inclusive
56    *
57    * @author Neil Rotstan
58    * @since 1.0
59    */

60   public int nextInt(int a_ceiling);
61
62   /**
63    * Returns the next pseudorandom, uniformly distributed long value from
64    * this random number generator's sequence. The general contract of
65    * nextLong() is that one long value is pseudorandomly generated and
66    * returned. All 2^64 possible long values are produced with
67    * (approximately) equal probability.
68    *
69    * @return a psuedorandom long value
70    *
71    * @author Neil Rotstan
72    * @since 1.0
73    */

74   public long nextLong();
75
76   /**
77    * Returns the next pseudorandom, uniformly distributed double value
78    * between 0.0 and 1.0 from this random number generator's sequence.
79    *
80    * @return a psuedorandom double value GREATER/EQUAL 0 AND LESS THAN 1
81    *
82    * @author Neil Rotstan
83    * @since 1.0
84    */

85   public double nextDouble();
86
87   /**
88    * Returns the next pseudorandom, uniformly distributed float value
89    * between 0.0 and 1.0 from this random number generator's sequence.
90    *
91    * @return a psuedorandom float value
92    *
93    * @author Neil Rotstan
94    * @since 1.0
95    */

96   public float nextFloat();
97
98   /**
99    * Returns the next pseudorandom, uniformly distributed boolean value
100    * from this random number generator's sequence. The general contract
101    * of nextBoolean is that one boolean value is pseudorandomly generated
102    * and returned. The values true and false are produced with
103    * (approximately) equal probability.
104    *
105    * @return a pseudorandom boolean value
106    *
107    * @author Neil Rotstan
108    * @since 1.0
109    */

110   public boolean nextBoolean();
111 }
112
Popular Tags