RandomNumbers
Index
RandomNumbers.RandomNumbersRandomNumbers.AbstractRNGRandomNumbers.WrappedRNGRandomNumbers.gen_seedRandomNumbers.output_typeRandomNumbers.randfloatRandomNumbers.randfloatRandomNumbers.randfloatRandomNumbers.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.randfloat — Method.
Random number generator for Float16 in [0,1) that samples from all 15360 float16s in that range.
#
RandomNumbers.randfloat — Method.
Random number generator for Float32 in [0,1) that samples from 42*2^23 float32s in [0,1) compared to 2^23 for rand(Float32).
#
RandomNumbers.randfloat — Method.
Random number generator for Float64 in [0,1) that samples from 64*2^52 floats compared to 2^52 for rand(Float64).
#
RandomNumbers.seed_type — Method.
Get the default seed type of a RNG.
Internal
<a id='RandomNumbers.gen_seed-Union{Tuple{Type{T}}, Tuple{T}} where T<:Number' href='#RandomNumbers.gen_seed-Union{Tuple{Type{T}}, Tuple{T}} where T<:Number'>#
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