Skip to content

Commit

Permalink
rename SamplerTypes (to close to SamplerType) to SamplerUnion
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Nov 19, 2017
1 parent 3050f01 commit 9dbc720
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base/random/RNGs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## RandomDevice

# SamplerTypes(Union{X,Y,...}) == Union{SamplerType{X},SamplerType{Y},...}
SamplerTypes(U::Union) = Union{map(T->SamplerType{T}, Base.uniontypes(U))...}
const SamplerBoolBitInteger = SamplerTypes(Union{Bool, Base.BitInteger})
# SamplerUnion(Union{X,Y,...}) == Union{SamplerType{X},SamplerType{Y},...}
SamplerUnion(U::Union) = Union{map(T->SamplerType{T}, Base.uniontypes(U))...}
const SamplerBoolBitInteger = SamplerUnion(Union{Bool, Base.BitInteger})

if Sys.iswindows()
struct RandomDevice <: AbstractRNG
Expand Down Expand Up @@ -244,7 +244,7 @@ rand(r::MersenneTwister, st::SamplerTrivial{<:FloatInterval}) = rand_generic(r,
#### integers

rand(r::MersenneTwister,
T::SamplerTypes(Union{Bool,Int8,UInt8,Int16,UInt16,Int32,UInt32})) =
T::SamplerUnion(Union{Bool,Int8,UInt8,Int16,UInt16,Int32,UInt32})) =
rand_ui52_raw(r) % T[]

function rand(r::MersenneTwister, ::SamplerType{UInt64})
Expand Down

0 comments on commit 9dbc720

Please sign in to comment.