From 786335720afa9b1fd8f533bc039f446a63969c13 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Thu, 17 Jan 2013 18:51:06 -0500 Subject: [PATCH] Move around a few names, since types and modules cannot have the same names. I like the new names. --- base/exports.jl | 2 +- base/{rng.jl => random.jl} | 9 +++++---- base/sysimg.jl | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) rename base/{rng.jl => random.jl} (98%) diff --git a/base/exports.jl b/base/exports.jl index 72eb9519a6357..5e8e659fb4d21 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -7,7 +7,7 @@ export LAPACK, BLAS, LibRandom, - RNG, + Random, Math, Sort, Test, diff --git a/base/rng.jl b/base/random.jl similarity index 98% rename from base/rng.jl rename to base/random.jl index b48826afab452..dd45e72fc44b3 100644 --- a/base/rng.jl +++ b/base/random.jl @@ -1,4 +1,4 @@ -module RNG +module Random using Base.LibRandom @@ -11,12 +11,10 @@ export librandom_init, srand, randchi2, randchi2!, randbeta, randbeta!, randbool, randbool!, - AbstractRNG, MersenneTwister + AbstractRNG, RNG, MersenneTwister abstract AbstractRNG -const RNG = MersenneTwister - type MersenneTwister <: AbstractRNG state::DSFMT_state seed::Union(Uint32,Vector{Uint32}) @@ -44,6 +42,9 @@ type MersenneTwister <: AbstractRNG end end +# MersenneTwister is the default RNG. +const RNG = MersenneTwister + function srand(r::MersenneTwister, seed) r.seed = seed dsfmt_init_gen_rand(r.state, seed) diff --git a/base/sysimg.jl b/base/sysimg.jl index 0e69b91ba0b1a..80443ad707fd5 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -125,8 +125,8 @@ importall Math # random number generation and statistics include("statistics.jl") include("librandom.jl") -include("rng.jl") -importall RNG +include("random.jl") +importall Random # Combinatorics include("sort.jl") @@ -201,10 +201,10 @@ compile_hint(cmp, (Int32, Int32)) compile_hint(min, (Int32, Int32)) compile_hint(==, (ASCIIString, ASCIIString)) compile_hint(arg_gen, (ASCIIString,)) -compile_hint(RNG.librandom_init, ()) -compile_hint(RNG.srand, (ASCIIString, Int)) +compile_hint(Random.librandom_init, ()) +compile_hint(Random.srand, (ASCIIString, Int)) +compile_hint(Random.srand, (Uint64,)) compile_hint(open, (ASCIIString, Bool, Bool, Bool, Bool)) -compile_hint(RNG.srand, (Uint64,)) compile_hint(done, (IntSet, Int64)) compile_hint(next, (IntSet, Int64)) compile_hint(ht_keyindex, (Dict{Any,Any}, Int32))