RestorableUniformRandomProvider
public interface UniformRandomProvider
Modifier and Type | Method | Description |
---|---|---|
boolean |
nextBoolean() |
Generates a
boolean value. |
void |
nextBytes(byte[] bytes) |
Generates
byte values and places them into a user-supplied array. |
void |
nextBytes(byte[] bytes,
int start,
int len) |
Generates
byte values and places them into a user-supplied array. |
double |
nextDouble() |
Generates a
double value between 0 and 1. |
float |
nextFloat() |
Generates a
float value between 0 and 1. |
int |
nextInt() |
Generates an
int value. |
int |
nextInt(int n) |
Generates an
int value between 0 (inclusive) and the
specified value (exclusive). |
long |
nextLong() |
Generates a
long value. |
long |
nextLong(long n) |
Generates a
long value between 0 (inclusive) and the specified
value (exclusive). |
void nextBytes(byte[] bytes)
byte
values and places them into a user-supplied array.
The number of random bytes produced is equal to the length of the the byte array.
bytes
- Byte array in which to put the random bytes.
Cannot be null
.void nextBytes(byte[] bytes, int start, int len)
byte
values and places them into a user-supplied array.
The array is filled with bytes extracted from random integers. This implies that the number of random bytes generated may be larger than the length of the byte array.
bytes
- Array in which to put the generated bytes.
Cannot be null
.start
- Index at which to start inserting the generated bytes.len
- Number of bytes to insert.IndexOutOfBoundsException
- if start < 0
or
start >= bytes.length
.IndexOutOfBoundsException
- if len < 0
or
len > bytes.length - start
.int nextInt()
int
value.int nextInt(int n)
int
value between 0 (inclusive) and the
specified value (exclusive).n
- Bound on the random number to be returned. Must be positive.int
value between 0 (inclusive) and n
(exclusive).IllegalArgumentException
- if n
is negative.long nextLong()
long
value.long nextLong(long n)
long
value between 0 (inclusive) and the specified
value (exclusive).n
- Bound on the random number to be returned. Must be positive.long
value between 0 (inclusive) and n
(exclusive).IllegalArgumentException
- if n
is negative.boolean nextBoolean()
boolean
value.float nextFloat()
float
value between 0 and 1.double nextDouble()
double
value between 0 and 1.Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.