| Age | Commit message (Collapse) | Author | Lines |
|
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.
|
|
`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.
|
|
|
|
Fallout from the previous commits
|
|
|
|
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).
|
|
Also remove all instances of 'self within the codebase.
This fixes #10889.
|
|
|
|
- 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
|
|
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.
|
|
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
|
|
Most importantly, links to the papers/references for the core
algorithms (the RNG ones & the distribution ones).
|
|
|
|
This much better handled by directly calling out to `OSRng` where
appropriate.
|
|
|
|
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.
|
|
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.
|
|
|