public interface GKRandom
This protocol allows you to provide custom random sources from classes that are not able to derive from GKRandomSource directly.
| Modifier and Type | Method and Description |
|---|---|
boolean |
nextBool()
Returns the next true or false value in the random sequence and moves ahead to the next one.
|
long |
nextInt()
Returns the next integer in the random sequence and moves ahead to the next one.
|
long |
nextIntWithUpperBound(long upperBound)
Returns the next unsigned value in the random sequence that is less than upperBound.
|
float |
nextUniform()
Returns the next uniform float in the random sequence and moves ahead to the next one.
|
boolean nextBool()
By default this should be based on nextIntWithUpperBound:. Implementations may base it on another representation if needed.
nextIntWithUpperBound:,
nextUniformlong nextInt()
nextBool,
nextUniformlong nextIntWithUpperBound(long upperBound)
This is used to implement nextBool and nextUniform by default.
float nextUniform()
By default this should be based on nextIntWithUpperBound:. Implementions may base it on another representation if needed.
nextIntWithUpperBound:,
nextInt