RandomNumbers
Index
RandomNumbers.RandomNumbers
RandomNumbers.AbstractRNG
RandomNumbers.WrappedRNG
RandomNumbers.gen_seed
RandomNumbers.output_type
RandomNumbers.seed_type
Common Functions
- Base.rand
- Random.rand!
- Random.seed!
- Base.randn
- Random.randn!
- Random.randexp
- Random.randexp!
- Random.bitrand
- Random.randstring
- Random.randsubseq
- Random.randsubseq!
- Random.randperm
- Random.randperm!
- Random.randcycle
- Random.randcycle!
- Random.shuffle
- Random.shuffle!
Public
#
RandomNumbers.RandomNumbers
— Module.
Main module for RandomNumbers.jl
– a random number generator package for Julia Language.
This module exports two types and four submodules:
#
RandomNumbers.AbstractRNG
— Type.
AbstractRNG{T} <: Random.AbstractRNG
The abstract type of Random Number Generators. T indicates the original output type of a RNG.
#
RandomNumbers.WrappedRNG
— Type.
WrappedRNG{R, T1, T2} <: AbstractRNG{T2} WrappedRNG(base_rng, T2) WrappedRNG(R, T2, args...)
Wrap a RNG which originally provides output in T1 into a RNG that provides output in T2.
Examples
julia> r = Xorshifts.Xorshift128Star(123); julia> RandomNumbers.output_type(r) UInt64 julia> r1 = WrappedRNG(r, UInt32); julia> RandomNumbers.output_type(r1) UInt32 julia> r2 = WrappedRNG(Xorshifts.Xorshift128Star, UInt32, 123); julia> RandomNumbers.output_type(r2) UInt32 julia> @Test.test rand(r1, UInt32, 3) == rand(r2, UInt32, 3) Test Passed
#
RandomNumbers.output_type
— Method.
Get the original output type of a RNG.
#
RandomNumbers.seed_type
— Method.
Get the default seed type of a RNG.
Internal
#
RandomNumbers.gen_seed
— Method.
gen_seed(T[, n])
Generate a tuple of n
truly random numbers in type T
. If n
is missing, return only one number. The "truly" random numbers are provided by the random device of system. See Random.RandomDevice
.
Examples
julia> RandomNumbers.gen_seed(UInt64, 2) # The output should probably be different on different computers. (0x26aa3fe5e306f725,0x7b9dc3c227d8acc9) julia> RandomNumbers.gen_seed(UInt32) 0x9ba60fdc