Skip to content

Commit aa1e88f

Browse files
committed
---
yaml --- r: 149869 b: refs/heads/try2 c: 6fa4bbe h: refs/heads/master i: 149867: bd9bcb7 v: v3
1 parent 3be1123 commit aa1e88f

File tree

19 files changed

+162
-199
lines changed

19 files changed

+162
-199
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 74bfa7108a62c053fdeae2bb093f8035e19e2ef2
8+
refs/heads/try2: 6fa4bbeed425ae99d15322fbaa05d1abeae6547f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@
5050
################################################################################
5151

5252
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
53-
uuid serialize sync getopts collections num test time
53+
uuid serialize sync getopts collections num test time rand
5454
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat
5555
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5656
TOOLS := compiletest rustdoc rustc
5757

5858
DEPS_std := native:rustrt native:compiler-rt
59-
DEPS_extra := std term sync serialize getopts collections time
60-
DEPS_green := std native:context_switch
59+
DEPS_extra := std term sync serialize getopts collections time rand
60+
DEPS_green := std rand native:context_switch
6161
DEPS_rustuv := std native:uv native:uv_support
6262
DEPS_native := std
6363
DEPS_syntax := std term serialize collections
@@ -71,15 +71,16 @@ DEPS_glob := std
7171
DEPS_serialize := std collections
7272
DEPS_term := std collections
7373
DEPS_semver := std
74-
DEPS_uuid := std serialize
74+
DEPS_uuid := std serialize rand
7575
DEPS_sync := std
7676
DEPS_getopts := std
77-
DEPS_collections := std
77+
DEPS_collections := std rand
7878
DEPS_fourcc := syntax std
7979
DEPS_hexfloat := syntax std
80-
DEPS_num := std
80+
DEPS_num := std rand
8181
DEPS_test := std extra collections getopts serialize term
8282
DEPS_time := std serialize
83+
DEPS_rand := std
8384

8485
TOOL_DEPS_compiletest := test green rustuv getopts
8586
TOOL_DEPS_rustdoc := rustdoc native

branches/try2/src/etc/ziggurat_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# except according to those terms.
1212

1313
# This creates the tables used for distributions implemented using the
14-
# ziggurat algorithm in `std::rand::distributions;`. They are
14+
# ziggurat algorithm in `rand::distributions;`. They are
1515
# (basically) the tables as used in the ZIGNOR variant (Doornik 2005).
1616
# They are changed rarely, so the generated file should be checked in
1717
# to git.

branches/try2/src/libstd/rand/distributions/exponential.rs renamed to branches/try2/src/librand/distributions/exponential.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
//! The exponential distribution.
1212
13-
use num::Float;
14-
use rand::{Rng, Rand};
15-
use rand::distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
13+
use std::num::Float;
14+
use {Rng, Rand};
15+
use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
1616

1717
/// A wrapper around an `f64` to generate Exp(1) random numbers.
1818
///
@@ -58,8 +58,7 @@ impl Rand for Exp1 {
5858
/// # Example
5959
///
6060
/// ```rust
61-
/// use std::rand;
62-
/// use std::rand::distributions::{Exp, IndependentSample};
61+
/// use rand::distributions::{Exp, IndependentSample};
6362
///
6463
/// let exp = Exp::new(2.0);
6564
/// let v = exp.ind_sample(&mut rand::task_rng());
@@ -91,10 +90,9 @@ impl IndependentSample<f64> for Exp {
9190

9291
#[cfg(test)]
9392
mod test {
94-
use rand::distributions::*;
95-
use prelude::*;
96-
use rand::*;
97-
use super::*;
93+
use distributions::{Sample, IndependentSample};
94+
use {Rng, task_rng};
95+
use super::Exp;
9896

9997
#[test]
10098
fn test_exp() {
@@ -121,11 +119,10 @@ mod test {
121119
mod bench {
122120
extern crate test;
123121
use self::test::BenchHarness;
124-
use mem::size_of;
125-
use prelude::*;
126-
use rand::{XorShiftRng, RAND_BENCH_N};
127-
use super::*;
128-
use rand::distributions::*;
122+
use std::mem::size_of;
123+
use {XorShiftRng, RAND_BENCH_N};
124+
use super::Exp;
125+
use distributions::Sample;
129126

130127
#[bench]
131128
fn rand_exp(bh: &mut BenchHarness) {

branches/try2/src/libstd/rand/distributions/gamma.rs renamed to branches/try2/src/librand/distributions/gamma.rs

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111
//! The Gamma and derived distributions.
1212
13-
use num::Float;
14-
use num;
15-
use rand::{Rng, Open01};
13+
use std::num::Float;
14+
use std::num;
15+
use {Rng, Open01};
1616
use super::normal::StandardNormal;
1717
use super::{IndependentSample, Sample, Exp};
1818

1919
/// The Gamma distribution `Gamma(shape, scale)` distribution.
2020
///
2121
/// The density function of this distribution is
2222
///
23-
/// ```ignore
23+
/// ```notrust
2424
/// f(x) = x^(k - 1) * exp(-x / θ) / (Γ(k) * θ^k)
2525
/// ```
2626
///
@@ -35,8 +35,7 @@ use super::{IndependentSample, Sample, Exp};
3535
/// # Example
3636
///
3737
/// ```rust
38-
/// use std::rand;
39-
/// use std::rand::distributions::{IndependentSample, Gamma};
38+
/// use rand::distributions::{IndependentSample, Gamma};
4039
///
4140
/// let gamma = Gamma::new(2.0, 5.0);
4241
/// let v = gamma.ind_sample(&mut rand::task_rng());
@@ -179,8 +178,7 @@ impl IndependentSample<f64> for GammaLargeShape {
179178
/// # Example
180179
///
181180
/// ```rust
182-
/// use std::rand;
183-
/// use std::rand::distributions::{ChiSquared, IndependentSample};
181+
/// use rand::distributions::{ChiSquared, IndependentSample};
184182
///
185183
/// let chi = ChiSquared::new(11.0);
186184
/// let v = chi.ind_sample(&mut rand::task_rng());
@@ -231,8 +229,7 @@ impl IndependentSample<f64> for ChiSquared {
231229
/// # Example
232230
///
233231
/// ```rust
234-
/// use std::rand;
235-
/// use std::rand::distributions::{FisherF, IndependentSample};
232+
/// use rand::distributions::{FisherF, IndependentSample};
236233
///
237234
/// let f = FisherF::new(2.0, 32.0);
238235
/// let v = f.ind_sample(&mut rand::task_rng());
@@ -275,8 +272,7 @@ impl IndependentSample<f64> for FisherF {
275272
/// # Example
276273
///
277274
/// ```rust
278-
/// use std::rand;
279-
/// use std::rand::distributions::{StudentT, IndependentSample};
275+
/// use rand::distributions::{StudentT, IndependentSample};
280276
///
281277
/// let t = StudentT::new(11.0);
282278
/// let v = t.ind_sample(&mut rand::task_rng());
@@ -310,10 +306,9 @@ impl IndependentSample<f64> for StudentT {
310306

311307
#[cfg(test)]
312308
mod test {
313-
use rand::distributions::*;
314-
use prelude::*;
315-
use rand::*;
316-
use super::*;
309+
use distributions::{Sample, IndependentSample};
310+
use {Rng, task_rng};
311+
use super::{ChiSquared, StudentT, FisherF};
317312

318313
#[test]
319314
fn test_chi_squared_one() {
@@ -344,7 +339,7 @@ mod test {
344339
}
345340
#[test]
346341
#[should_fail]
347-
fn test_log_normal_invalid_dof() {
342+
fn test_chi_squared_invalid_dof() {
348343
ChiSquared::new(-1.0);
349344
}
350345

@@ -373,11 +368,10 @@ mod test {
373368
mod bench {
374369
extern crate test;
375370
use self::test::BenchHarness;
376-
use mem::size_of;
377-
use prelude::*;
378-
use rand::distributions::IndependentSample;
379-
use rand::{StdRng, RAND_BENCH_N};
380-
use super::*;
371+
use std::mem::size_of;
372+
use distributions::IndependentSample;
373+
use {StdRng, RAND_BENCH_N};
374+
use super::Gamma;
381375

382376

383377
#[bench]

branches/try2/src/libstd/rand/distributions/mod.rs renamed to branches/try2/src/librand/distributions/mod.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,9 @@ that do not need to record state.
2020
2121
*/
2222

23-
use container::Container;
24-
use iter::{range, Iterator};
25-
use option::{Some, None};
26-
use num;
27-
use num::CheckedAdd;
28-
use rand::{Rng, Rand};
29-
use clone::Clone;
30-
use vec::MutableVector;
23+
use std::num;
24+
use std::num::CheckedAdd;
25+
use {Rng, Rand};
3126

3227
pub use self::range::Range;
3328
pub use self::gamma::{Gamma, ChiSquared, FisherF, StudentT};
@@ -94,8 +89,7 @@ pub struct Weighted<T> {
9489
/// # Example
9590
///
9691
/// ```rust
97-
/// use std::rand;
98-
/// use std::rand::distributions::{Weighted, WeightedChoice, IndependentSample};
92+
/// use rand::distributions::{Weighted, WeightedChoice, IndependentSample};
9993
///
10094
/// let wc = WeightedChoice::new(~[Weighted { weight: 2, item: 'a' },
10195
/// Weighted { weight: 4, item: 'b' },
@@ -253,9 +247,8 @@ fn ziggurat<R:Rng>(
253247

254248
#[cfg(test)]
255249
mod tests {
256-
use prelude::*;
257-
use rand::*;
258-
use super::*;
250+
use {task_rng, Rng, Rand};
251+
use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample};
259252

260253
#[deriving(Eq, Show)]
261254
struct ConstRand(uint);

branches/try2/src/libstd/rand/distributions/normal.rs renamed to branches/try2/src/librand/distributions/normal.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
//! The normal and derived distributions.
1212
13-
use num::Float;
14-
use rand::{Rng, Rand, Open01};
15-
use rand::distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
13+
use std::num::Float;
14+
use {Rng, Rand, Open01};
15+
use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
1616

1717
/// A wrapper around an `f64` to generate N(0, 1) random numbers
1818
/// (a.k.a. a standard normal, or Gaussian).
@@ -74,8 +74,7 @@ impl Rand for StandardNormal {
7474
/// # Example
7575
///
7676
/// ```rust
77-
/// use std::rand;
78-
/// use std::rand::distributions::{Normal, IndependentSample};
77+
/// use rand::distributions::{Normal, IndependentSample};
7978
///
8079
/// // mean 2, standard deviation 3
8180
/// let normal = Normal::new(2.0, 3.0);
@@ -117,8 +116,7 @@ impl IndependentSample<f64> for Normal {
117116
/// # Example
118117
///
119118
/// ```rust
120-
/// use std::rand;
121-
/// use std::rand::distributions::{LogNormal, IndependentSample};
119+
/// use rand::distributions::{LogNormal, IndependentSample};
122120
///
123121
/// // mean 2, standard deviation 3
124122
/// let log_normal = LogNormal::new(2.0, 3.0);
@@ -148,10 +146,9 @@ impl IndependentSample<f64> for LogNormal {
148146

149147
#[cfg(test)]
150148
mod tests {
151-
use prelude::*;
152-
use rand::*;
153-
use super::*;
154-
use rand::distributions::*;
149+
use distributions::{Sample, IndependentSample};
150+
use {Rng, task_rng};
151+
use super::{Normal, LogNormal};
155152

156153
#[test]
157154
fn test_normal() {
@@ -189,11 +186,10 @@ mod tests {
189186
mod bench {
190187
extern crate test;
191188
use self::test::BenchHarness;
192-
use mem::size_of;
193-
use prelude::*;
194-
use rand::{XorShiftRng, RAND_BENCH_N};
195-
use rand::distributions::*;
196-
use super::*;
189+
use std::mem::size_of;
190+
use {XorShiftRng, RAND_BENCH_N};
191+
use distributions::{Sample};
192+
use super::Normal;
197193

198194
#[bench]
199195
fn rand_normal(bh: &mut BenchHarness) {

branches/try2/src/libstd/rand/distributions/range.rs renamed to branches/try2/src/librand/distributions/range.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
1313
// this is surprisingly complicated to be both generic & correct
1414

15-
use cmp::Ord;
16-
use num::Bounded;
17-
use rand::Rng;
18-
use rand::distributions::{Sample, IndependentSample};
15+
use std::num::Bounded;
16+
use Rng;
17+
use distributions::{Sample, IndependentSample};
1918

2019
/// Sample values uniformly between two bounds.
2120
///
@@ -34,8 +33,7 @@ use rand::distributions::{Sample, IndependentSample};
3433
/// # Example
3534
///
3635
/// ```rust
37-
/// use std::rand;
38-
/// use std::rand::distributions::{IndependentSample, Range};
36+
/// use rand::distributions::{IndependentSample, Range};
3937
///
4038
/// fn main() {
4139
/// let between = Range::new(10u, 10000u);
@@ -163,11 +161,10 @@ float_impl! { f64 }
163161

164162
#[cfg(test)]
165163
mod tests {
166-
use prelude::*;
167-
use super::*;
168-
use rand::*;
169-
use rand::distributions::*;
170-
use num::Bounded;
164+
use distributions::{Sample, IndependentSample};
165+
use {Rng, task_rng};
166+
use super::Range;
167+
use std::num::Bounded;
171168

172169
#[should_fail]
173170
#[test]

branches/try2/src/libstd/rand/isaac.rs renamed to branches/try2/src/librand/isaac.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010

1111
//! The ISAAC random number generator.
1212
13-
use rand::{Rng, SeedableRng, OSRng};
14-
use iter::{Iterator, range, range_step, Repeat};
15-
use option::{None, Some};
16-
use vec::{raw, MutableVector, ImmutableVector};
17-
use mem;
13+
use {Rng, SeedableRng, OSRng};
14+
use std::iter::{range_step, Repeat};
15+
use std::vec::raw;
16+
use std::mem;
1817

1918
static RAND_SIZE_LEN: u32 = 8;
2019
static RAND_SIZE: u32 = 1 << RAND_SIZE_LEN;
@@ -430,10 +429,9 @@ impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng {
430429

431430
#[cfg(test)]
432431
mod test {
433-
use super::*;
434-
use rand::{Rng, SeedableRng, OSRng};
435-
use prelude::*;
436-
use vec;
432+
use super::{IsaacRng, Isaac64Rng};
433+
use {Rng, SeedableRng, OSRng};
434+
use std::vec;
437435

438436
#[test]
439437
fn test_rng_32_rand_seeded() {

0 commit comments

Comments
 (0)