Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

74 lines (56 sloc) 2.586 kB
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2006-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.util
/**
* @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) }
}
Jump to Line
Something went wrong with that request. Please try again.