diff options
| -rw-r--r-- | src/librand/distributions/exponential.rs | 2 | ||||
| -rw-r--r-- | src/librand/distributions/gamma.rs | 10 | ||||
| -rw-r--r-- | src/librand/distributions/mod.rs | 8 | ||||
| -rw-r--r-- | src/librand/distributions/normal.rs | 6 | ||||
| -rw-r--r-- | src/librand/distributions/range.rs | 6 | ||||
| -rw-r--r-- | src/librand/isaac.rs | 24 | ||||
| -rw-r--r-- | src/librand/lib.rs | 18 | ||||
| -rw-r--r-- | src/librand/os.rs | 4 | ||||
| -rw-r--r-- | src/librand/reader.rs | 2 | ||||
| -rw-r--r-- | src/librand/reseeding.rs | 8 |
10 files changed, 45 insertions, 43 deletions
diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs index 369828d5969..5a6b925c53f 100644 --- a/src/librand/distributions/exponential.rs +++ b/src/librand/distributions/exponential.rs @@ -66,7 +66,7 @@ impl Rand for Exp1 { /// ``` pub struct Exp { /// `lambda` stored as `1/lambda`, since this is what we scale by. - priv lambda_inverse: f64 + lambda_inverse: f64 } impl Exp { diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 029333cd788..1e9b5cbe99e 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -236,11 +236,11 @@ impl IndependentSample<f64> for ChiSquared { /// println!("{} is from an F(2, 32) distribution", v) /// ``` pub struct FisherF { - priv numer: ChiSquared, - priv denom: ChiSquared, + numer: ChiSquared, + denom: ChiSquared, // denom_dof / numer_dof so that this can just be a straight // multiplication, rather than a division. - priv dof_ratio: f64, + dof_ratio: f64, } impl FisherF { @@ -279,8 +279,8 @@ impl IndependentSample<f64> for FisherF { /// println!("{} is from a t(11) distribution", v) /// ``` pub struct StudentT { - priv chi: ChiSquared, - priv dof: f64 + chi: ChiSquared, + dof: f64 } impl StudentT { diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 22a09b152c7..23230880278 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -71,9 +71,9 @@ impl<Sup: Rand> IndependentSample<Sup> for RandSample<Sup> { /// A value with a particular weight for use with `WeightedChoice`. pub struct Weighted<T> { /// The numerical weight of this item - weight: uint, + pub weight: uint, /// The actual item which is being weighted - item: T, + pub item: T, } /// A distribution that selects from a finite collection of weighted items. @@ -101,8 +101,8 @@ pub struct Weighted<T> { /// } /// ``` pub struct WeightedChoice<T> { - priv items: ~[Weighted<T>], - priv weight_range: Range<uint> + pub items: ~[Weighted<T>], + pub weight_range: Range<uint> } impl<T: Clone> WeightedChoice<T> { diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs index 4c9567efc6e..42fb76ad4eb 100644 --- a/src/librand/distributions/normal.rs +++ b/src/librand/distributions/normal.rs @@ -82,8 +82,8 @@ impl Rand for StandardNormal { /// println!("{} is from a N(2, 9) distribution", v) /// ``` pub struct Normal { - priv mean: f64, - priv std_dev: f64 + mean: f64, + std_dev: f64, } impl Normal { @@ -124,7 +124,7 @@ impl IndependentSample<f64> for Normal { /// println!("{} is from an ln N(2, 9) distribution", v) /// ``` pub struct LogNormal { - priv norm: Normal + norm: Normal } impl LogNormal { diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index 8256a37f2ec..cee80b62e3d 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -46,9 +46,9 @@ use distributions::{Sample, IndependentSample}; /// } /// ``` pub struct Range<X> { - priv low: X, - priv range: X, - priv accept_zone: X + low: X, + range: X, + accept_zone: X } impl<X: SampleRange + Ord> Range<X> { diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs index d0dc5b90867..5c14d2c9f5b 100644 --- a/src/librand/isaac.rs +++ b/src/librand/isaac.rs @@ -28,12 +28,12 @@ static RAND_SIZE: u32 = 1 << RAND_SIZE_LEN; /// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number /// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html) pub struct IsaacRng { - priv cnt: u32, - priv rsl: [u32, .. RAND_SIZE], - priv mem: [u32, .. RAND_SIZE], - priv a: u32, - priv b: u32, - priv c: u32 + cnt: u32, + rsl: [u32, .. RAND_SIZE], + mem: [u32, .. RAND_SIZE], + a: u32, + b: u32, + c: u32 } static EMPTY: IsaacRng = IsaacRng { cnt: 0, @@ -231,12 +231,12 @@ static RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN; /// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number /// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html) pub struct Isaac64Rng { - priv cnt: uint, - priv rsl: [u64, .. RAND_SIZE_64], - priv mem: [u64, .. RAND_SIZE_64], - priv a: u64, - priv b: u64, - priv c: u64, + cnt: uint, + rsl: [u64, .. RAND_SIZE_64], + mem: [u64, .. RAND_SIZE_64], + a: u64, + b: u64, + c: u64, } static EMPTY_64: Isaac64Rng = Isaac64Rng { diff --git a/src/librand/lib.rs b/src/librand/lib.rs index f8183b08ce9..d9920501ab0 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -72,6 +72,8 @@ println!("{:?}", tuple_ptr) #![feature(macro_rules, managed_boxes, phase)] +#![allow(visible_private_types)] // NOTE: remove after a stage0 snap + #[cfg(test)] #[phase(syntax, link)] extern crate log; @@ -407,12 +409,12 @@ pub fn rng() -> StdRng { /// The standard RNG. This is designed to be efficient on the current /// platform. #[cfg(not(target_word_size="64"))] -pub struct StdRng { priv rng: IsaacRng } +pub struct StdRng { rng: IsaacRng } /// The standard RNG. This is designed to be efficient on the current /// platform. #[cfg(target_word_size="64")] -pub struct StdRng { priv rng: Isaac64Rng } +pub struct StdRng { rng: Isaac64Rng } impl StdRng { /// Create a randomly seeded instance of `StdRng`. @@ -489,10 +491,10 @@ pub fn weak_rng() -> XorShiftRng { /// RNGs"](http://www.jstatsoft.org/v08/i14/paper). *Journal of /// Statistical Software*. Vol. 8 (Issue 14). pub struct XorShiftRng { - priv x: u32, - priv y: u32, - priv z: u32, - priv w: u32, + x: u32, + y: u32, + z: u32, + w: u32, } impl Rng for XorShiftRng { @@ -573,8 +575,8 @@ pub struct TaskRng { // The use of unsafe code here is OK if the invariants above are // satisfied; and it allows us to avoid (unnecessarily) using a // GC'd or RC'd pointer. - priv rng: *mut TaskRngInner, - priv marker: marker::NoSend, + rng: *mut TaskRngInner, + marker: marker::NoSend, } // used to make space in TLS for a random number generator diff --git a/src/librand/os.rs b/src/librand/os.rs index 0f4169bfe28..6ba919a7e65 100644 --- a/src/librand/os.rs +++ b/src/librand/os.rs @@ -30,7 +30,7 @@ mod imp { /// This does not block. #[cfg(unix)] pub struct OSRng { - priv inner: ReaderRng<File> + inner: ReaderRng<File> } impl OSRng { @@ -77,7 +77,7 @@ mod imp { /// /// This does not block. pub struct OSRng { - priv hcryptprov: HCRYPTPROV + hcryptprov: HCRYPTPROV } static PROV_RSA_FULL: DWORD = 1; diff --git a/src/librand/reader.rs b/src/librand/reader.rs index 9e7e38d2723..76a0efc92a9 100644 --- a/src/librand/reader.rs +++ b/src/librand/reader.rs @@ -27,7 +27,7 @@ use Rng; /// println!("{:x}", rng.gen::<uint>()); /// ``` pub struct ReaderRng<R> { - priv reader: R + reader: R } impl<R: Reader> ReaderRng<R> { diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs index a64124e637e..70108d76b56 100644 --- a/src/librand/reseeding.rs +++ b/src/librand/reseeding.rs @@ -21,11 +21,11 @@ static DEFAULT_GENERATION_THRESHOLD: uint = 32 * 1024; /// A wrapper around any RNG which reseeds the underlying RNG after it /// has generated a certain number of random bytes. pub struct ReseedingRng<R, Rsdr> { - priv rng: R, - priv generation_threshold: uint, - priv bytes_generated: uint, + rng: R, + generation_threshold: uint, + bytes_generated: uint, /// Controls the behaviour when reseeding the RNG. - reseeder: Rsdr + pub reseeder: Rsdr, } impl<R: Rng, Rsdr: Reseeder<R>> ReseedingRng<R, Rsdr> { |
