标签:io ar os java for on as size new
pseudorandom:伪随机/**
* Creates a new random number generator using a single {@code long} seed.
* The seed is the initial value of the internal state of the pseudorandom
* number generator which is maintained by method {@link #next}.
*
* <p>The invocation {@code new Random(seed)} is equivalent to:
* <pre> {@code
* Random rnd = new Random();
* rnd.setSeed(seed);}</pre>
*
* @param seed the initial seed
* @see #setSeed(long)
*/
public Random(long seed) {
this.seed = new AtomicLong(0L);
setSeed(seed);
}
/**
* Returns the next pseudorandom, uniformly distributed {@code int}
* value from this random number generator‘s sequence. The general
* contract of {@code nextInt} is that one {@code int} value is
* pseudorandomly generated and returned. All 2<font size="-1"><sup>32
* </sup></font> possible {@code int} values are produced with
* (approximately) equal probability.
*
* <p>The method {@code nextInt} is implemented by class {@code Random}
* as if by:
* <pre> {@code
* public int nextInt() {
* return next(32);
* }}</pre>
*
* @return the next pseudorandom, uniformly distributed {@code int}
* value from this random number generator‘s sequence
*/
public int nextInt() {
return next(32);
}
标签:io ar os java for on as size new
原文地址:http://my.oschina.net/wrean/blog/346651