Random

class Random(val self: Random) extends Serializable
Companion
object
class Object
trait Matchable
class Any
object Random

Value members

Constructors

def this(seed: Long)

Creates a new random number generator using a single long seed.

Creates a new random number generator using a single long seed.

def this(seed: Int)

Creates a new random number generator using a single integer seed.

Creates a new random number generator using a single integer seed.

def this()

Creates a new random number generator.

Creates a new random number generator.

Concrete methods

@migration("`alphanumeric` returns a LazyList instead of a Stream", "2.13.0")

Returns a LazyList of pseudorandomly chosen alphanumeric characters, equally chosen from A-Z, a-z, and 0-9.

Returns a LazyList of pseudorandomly chosen alphanumeric characters, equally chosen from A-Z, a-z, and 0-9.

def between(minInclusive: Double, maxExclusive: Double): Double

Returns the next pseudorandom, uniformly distributed double value between min (inclusive) and max (exclusive) from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed double value between min (inclusive) and max (exclusive) from this random number generator's sequence.

def between(minInclusive: Float, maxExclusive: Float): Float

Returns the next pseudorandom, uniformly distributed float value between min (inclusive) and max (exclusive) from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed float value between min (inclusive) and max (exclusive) from this random number generator's sequence.

def between(minInclusive: Int, maxExclusive: Int): Int

Returns a pseudorandom, uniformly distributed int value between min (inclusive) and the specified value max (exclusive), drawn from this random number generator's sequence.

Returns a pseudorandom, uniformly distributed int value between min (inclusive) and the specified value max (exclusive), drawn from this random number generator's sequence.

def between(minInclusive: Long, maxExclusive: Long): Long

Returns a pseudorandom, uniformly distributed long value between min (inclusive) and the specified value max (exclusive), drawn from this random number generator's sequence.

Returns a pseudorandom, uniformly distributed long value between min (inclusive) and the specified value max (exclusive), drawn from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.

def nextBytes(bytes: Array[Byte]): Unit

Generates random bytes and places them into a user-supplied byte array.

Generates random bytes and places them into a user-supplied byte array.

def nextBytes(n: Int): Array[Byte]

Generates n random bytes and returns them in a new array.

Generates n random bytes and returns them in a new array.

Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

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.

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 nextInt(): Int

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.

def nextInt(n: Int): Int

Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

def nextLong(): Long

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.

def nextLong(n: Long): Long

Returns a pseudorandom, uniformly distributed long value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

Returns a pseudorandom, uniformly distributed long value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed value from the ASCII range 33-126.

Returns the next pseudorandom, uniformly distributed value from the ASCII range 33-126.

def nextString(length: Int): String

Returns a pseudorandomly generated String.

Returns a pseudorandomly generated String. This routine does not take any measures to preserve the randomness of the distribution in the face of factors like unicode's variable-length encoding, so please don't use this for anything important. It's primarily intended for generating test data.

Value Params
length

the desired length of the String

Returns

the String

def setSeed(seed: Long): Unit
def shuffle[T, C](xs: IterableOnce[T])(bf: BuildFrom[xs, T, C]): C

Returns a new collection of the same type in a randomly chosen order.

Returns a new collection of the same type in a randomly chosen order.

Returns

the shuffled collection

Concrete fields

val self: Random