DthingApi
|
Public Member Functions | |
Random () | |
Random (long seed) | |
boolean | nextBoolean () |
void | nextBytes (byte[] buf) |
double | nextDouble () |
float | nextFloat () |
int | nextInt () |
int | nextInt (int n) |
long | nextLong () |
synchronized void | setSeed (long seed) |
Protected Member Functions | |
synchronized int | next (int bits) |
This class provides methods that return pseudo-random values.
It is dangerous to seed
with the current time because that value is more predictable to an attacker than the default seed.
This class is thread-safe.
|
inline |
Constructs a random generator with an initial state that is unlikely to be duplicated by a subsequent instantiation.
The initial state (that is, the seed) is partially based on the current time of day in milliseconds.
|
inline |
|
inlineprotected |
Returns a pseudo-random uniformly distributed
value of the number of bits specified by the argument
as described by Donald E. Knuth in The Art of Computer Programming, Volume 2: Seminumerical Algorithms, section 3.2.1.
Most applications will want to use one of this class' convenience methods instead.
|
inline |
Returns a pseudo-random uniformly distributed
.
|
inline |
Fills
with random bytes.
|
inline |
Returns a pseudo-random uniformly distributed
in the half-open range [0.0, 1.0).
|
inline |
Returns a pseudo-random uniformly distributed
in the half-open range [0.0, 1.0).
|
inline |
Returns a pseudo-random uniformly distributed
.
|
inline |
Returns a pseudo-random uniformly distributed
in the half-open range [0, n).
|
inline |
Returns a pseudo-random uniformly distributed
.
|
inline |
Modifies the seed using a linear congruential formula presented in The Art of Computer Programming, Volume 2, Section 3.2.1.