Package org.pipecraft.infra.math
Class FastRandom
- java.lang.Object
-
- java.util.Random
-
- org.pipecraft.infra.math.FastRandom
-
- All Implemented Interfaces:
Serializable
public class FastRandom extends Random
A fast version ofRandom, which extends from it but eliminates thread safety.ThreadLocalRandomhas a similar performance, but by design it doesn't allow specifying the seed. Usage of 3rd patry implementations is also possible, but this implementation is guaranteed to have the same behavior of java.util.Random, given the same seed.- Author:
- Eyal Schneider
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FastRandom()Constructor Uses a seed derived from the clockFastRandom(long seed)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intnext(int bits)
-