about summary refs log tree commit diff
path: root/src/libstd/rand/isaac.rs
AgeCommit message (Collapse)AuthorLines
2014-03-12std: Move rand to librand.Huon Wilson-535/+0
This functionality is not super-core and so doesn't need to be included in std. It's possible that std may need rand (it does a little bit now, for io::test) in which case the functionality required could be moved to a secret hidden module and reexposed by librand. Unfortunately, using #[deprecated] here is hard: there's too much to mock to make it feasible, since we have to ensure that programs still typecheck to reach the linting phase.
2014-01-30Remove Times traitBrendan Zabarauskas-2/+1
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-07stdtest: Fix all leaked trait importsAlex Crichton-2/+1
2014-01-07std: Fill in all missing importsAlex Crichton-1/+2
Fallout from the previous commits
2013-12-15std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].Huon Wilson-2/+2
2013-12-15std::vec: move pointless `raw::get` and `unsafe_get` functions.Huon Wilson-4/+4
This can easily be written as `(*v.unsafe_ref(i)).clone()`, or just `*v.unsafe_ref(i)` for primitive types like `i32` (the common case).
2013-12-11Make 'self lifetime illegal.Erik Price-6/+6
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-5/+5
2013-10-23auto merge of #9810 : huonw/rust/rand3, r=alexcrichtonbors-7/+17
- Adds the `Sample` and `IndependentSample` traits for generating numbers where there are parameters (e.g. a list of elements to draw from, or the mean/variance of a normal distribution). The former takes `&mut self` and the latter takes `&self` (this is the only difference). - Adds proper `Normal` and `Exp`-onential distributions - Adds `Range` which generates `[lo, hi)` generically & properly (via a new trait) replacing the incorrect behaviour of `Rng.gen_integer_range` (this has become `Rng.gen_range` for convenience, it's far more efficient to use `Range` itself) - Move the `Weighted` struct from `std::rand` to `std::rand::distributions` & improve it - optimisations and docs
2013-10-23std::rand: seed ISAAC with no transmutes.Huon Wilson-7/+16
Slice transmutes are now (and, really, always were) dangerous, so we avoid them and do the (only?) non-(undefined behaviour in C) pointer cast: casting to *u8.
2013-10-23std::rand: use "nothing up your sleeve numbers" for ISAAC tests.Huon Wilson-18/+18
There's no value in using the "random" numbers, when nothing up your sleeve numbers are perfectly serviceable. http://en.wikipedia.org/wiki/Nothing_up_my_sleeve_number
2013-10-23std::rand: documentation & references.Huon Wilson-7/+17
Most importantly, links to the papers/references for the core algorithms (the RNG ones & the distribution ones).
2013-10-09std::rand: Make Rng.next_u32 non-default, waiting for #7771.Huon Wilson-0/+6
2013-10-09std::rand: remove `seed`.Huon Wilson-36/+40
This much better handled by directly calling out to `OSRng` where appropriate.
2013-10-09std::rand: add & split some tests.Huon Wilson-6/+31
2013-10-09std::rand: Add a trait for seeding RNGs: SeedableRng.Huon Wilson-80/+133
This provides 2 methods: .reseed() and ::from_seed that modify and create respecitively. Implement this trait for the RNGs in the stdlib for which this makes sense.
2013-10-09std::rand: Add an implementation of ISAAC64.Huon Wilson-1/+232
This is 2x faster on 64-bit computers at generating anything larger than 32-bits. It has been verified against the canonical C implementation from the website of the creator of ISAAC64. Also, move `Rng.next` to `Rng.next_u32` and add `Rng.next_u64` to take full advantage of the wider word width; otherwise Isaac64 will always be squeezed down into a u32 wasting half the entropy and offering no advantage over the 32-bit variant.
2013-10-09std::rand: move the Isaac implementation to its own file.Huon Wilson-0/+198