blob: 6cc0d51adac2980c3e39e467b0acfff87bbe0053 (
plain) (
tree)
|
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id: $
package scala
/**
* @author Stephane Micheloud
*/
class Random(val self: java.util.Random) {
/** Creates a new random number generator using a single long seed. */
def this(seed: Long) = this(new java.util.Random(seed))
/** Creates a new random number generator using a single integer seed. */
def this(seed: Int) = this(seed.toLong)
/** Creates a new random number generator. */
def this() = this(compat.Platform.currentTime)
/** Returns the next pseudorandom, uniformly distributed boolean value
* from this random number generator's sequence.
*/
def nextBoolean(): Boolean = self.nextBoolean()
/** Generates random bytes and places them into a user-supplied byte
* array.
*/
def nextBytes(bytes: Array[Byte]) { self.nextBytes(bytes) }
/** Returns the next pseudorandom, uniformly distributed double value
* between 0.0 and 1.0 from this random number generator's sequence.
*/
def nextDouble(): Double = self.nextDouble()
/** Returns the next pseudorandom, uniformly distributed float value
* between 0.0 and 1.0 from this random number generator's sequence.
*/
def nextFloat(): Float = self.nextFloat()
/** Returns the next pseudorandom, Gaussian ("normally") distributed
* double value with mean 0.0 and standard deviation 1.0 from this
* random number generator's sequence.
*/
//def nextGaussian(): Double = self.nextGaussian()
/** Returns the next pseudorandom, uniformly distributed int value
* from this random number generator's sequence.
*/
def nextInt(): Int = self.nextInt()
/** Returns a pseudorandom, uniformly distributed int value between 0
* (inclusive) and the specified value (exclusive), drawn from this
* random number generator's sequence.
*/
def nextInt(n: Int): Int = self.nextInt(n)
/** Returns the next pseudorandom, uniformly distributed long value
* from this random number generator's sequence.
*/
def nextLong(): Long = self.nextLong()
def setSeed(seed: Long) { self.setSeed(seed) }
}
|