about summary refs log tree commit diff
path: root/src/libstd/rand/mod.rs
AgeCommit message (Collapse)AuthorLines
2017-11-08std: Remove `rand` crate and moduleAlex Crichton-286/+0
This commit removes the `rand` crate from the standard library facade as well as the `__rand` module in the standard library. Neither of these were used in any meaningful way in the standard library itself. The only need for randomness in libstd is to initialize the thread-local keys of a `HashMap`, and that unconditionally used `OsRng` defined in the standard library anyway. The cruft of the `rand` crate and the extra `rand` support in the standard library makes libstd slightly more difficult to port to new platforms, namely WebAssembly which doesn't have any randomness at all (without interfacing with JS). The purpose of this commit is to clarify and streamline randomness in libstd, focusing on how it's only required in one location, hashmap seeds. Note that the `rand` crate out of tree has almost always been a drop-in replacement for the `rand` crate in-tree, so any usage (accidental or purposeful) of the crate in-tree should switch to the `rand` crate on crates.io. This then also has the further benefit of avoiding duplication (mostly) between the two crates!
2017-06-16Introduce tidy lint to check for inconsistent tracking issuesest31-1/+1
This commit * Refactors the collect_lib_features function to work in a non-checking mode (no bad pointer needed, and list of lang features). * Introduces checking whether unstable/stable tags for a given feature have inconsistent tracking issues. * Fixes such inconsistencies throughout the codebase.
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-2/+2
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-0/+7
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-10-31Changed most vec! invocations to use square bracesiirelu-1/+1
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+1
2016-02-17std: restructure rand os code into sys modulesSean McArthur-2/+93
2015-12-18Use the getentropy(2) syscall on OpenBSDMichael McConville-0/+1
Rust already supports Linux's getrandom(2), which is very similar and was based on getentropy(2). This is a pretty clean, simple addition that uses the same approach as the iOS randomness API support.
2015-08-15std: Add issues to all unstable featuresAlex Crichton-1/+1
2015-08-11Register new snapshotsAlex Crichton-3/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-03syntax: Implement #![no_core]Alex Crichton-0/+1
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-05-28remove references to IoResultSteve Klabnik-1/+1
This is now std::io::Result
2015-04-14rand: Delete all doc testsAlex Crichton-168/+0
None of these actually compile any more!
2015-04-14test: Fixup many library unit testsAlex Crichton-258/+0
2015-04-14std: Remove old_io/old_path/rand modulesAlex Crichton-105/+7
This commit entirely removes the old I/O, path, and rand modules. All functionality has been deprecated and unstable for quite some time now!
2015-03-28Remove IteratorExtSteven Fackler-1/+1
All methods are inlined into Iterator with `Self: Sized` bounds to make sure Iterator is still object safe. [breaking-change]
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-24/+24
Now that support has been removed, all lingering use cases are renamed.
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+7
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-1/+1
2015-03-11Example -> ExamplesSteve Klabnik-1/+1
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-09Rename #[should_fail] to #[should_panic]Steven Fackler-2/+2
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-1/+1
2015-03-03Auto merge of #22532 - pnkfelix:arith-overflow, r=pnkfelix,eddybbors-2/+2
Rebase and follow-through on work done by @cmr and @aatch. Implements most of rust-lang/rfcs#560. Errors encountered from the checks during building were fixed. The checks for division, remainder and bit-shifting have not been implemented yet. See also PR #20795 cc @Aatch ; cc @nikomatsakis
2015-03-03Accommodate arith-overflow in `rand` and `std::rand`.Felix S. Klock II-2/+2
Regarding the `rand` changes: It is unfortunate that Wrapping(T) does not support the `+=` operator. We may want to try to fix that before 1.0 to make porting code like this palatable. Regarding `std::rand`, just arith-overflow in first example from `std::rand::random()` doc.
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-5/+4
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-02-18rollup merge of #22497: nikomatsakis/suffixesAlex Crichton-5/+5
Conflicts: src/librustc_trans/trans/tvec.rs
2015-02-18Remove `i`, `is`, `u`, or `us` suffixes that are not necessary.Niko Matsakis-5/+5
2015-02-18Remove usage of .map(|&foo| foo)Kevin Butler-1/+1
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-5/+5
2015-02-04Auto merge of #21892 - huonw:deprecate-rand, r=alexcrichtonbors-0/+3
Use [`rand`](https://crates.io/crates/rand) and [`derive_rand`](https://crates.io/crates/derive_rand) from crates.io. [breaking-change]
2015-02-04Deprecate in-tree `rand`, `std::rand` and `#[derive(Rand)]`.Huon Wilson-0/+3
Use the crates.io crate `rand` (version 0.1 should be a drop in replacement for `std::rand`) and `rand_macros` (`#[derive_Rand]` should be a drop-in replacement). [breaking-change]
2015-02-02`for x in xs.iter()` -> `for x in &xs`Jorge Aparicio-1/+1
2015-01-30Remove all `i` suffixesTobias Bucher-14/+14
2015-01-29convert remaining `range(a, b)` to `a..b`Jorge Aparicio-1/+1
2015-01-29`for x in range(a, b)` -> `for x in a..b`Jorge Aparicio-8/+8
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-29`range(a, b).foo()` -> `(a..b).foo()`Jorge Aparicio-2/+2
sed -i 's/ range(\([^,]*\), *\([^()]*\))\./ (\1\.\.\2)\./g' **/*.rs
2015-01-28Merge remote-tracking branch 'origin/master' into rollupManish Goregaokar-1/+1
Conflicts: src/libcollections/slice.rs src/libcore/nonzero.rs src/libcore/ops.rs
2015-01-28Rollup merge of #21676 - Victory:fix-deprication-in-random, r=alexcrichtonManish Goregaokar-27/+27
Cleanup mention of uint, use usize/us instead. This includes the example `println!("{}", 2u * x);`
2015-01-27Merge remote-tracking branch 'rust-lang/master'Brian Anderson-1/+1
Conflicts: src/libcore/cell.rs src/librustc_driver/test.rs src/libstd/old_io/net/tcp.rs src/libstd/old_io/process.rs
2015-01-26Don't use if we can avoid itVictory-20/+20
2015-01-26cleanup depricated `uint` in rand mod and rand osVictory-27/+27
2015-01-26Fallout of io => old_ioAlex Crichton-1/+1
2015-01-23Set unstable feature names appropriatelyBrian Anderson-1/+1
* `core` - for the core crate * `hash` - hashing * `io` - io * `path` - path * `alloc` - alloc crate * `rand` - rand crate * `collections` - collections crate * `std_misc` - other parts of std * `test` - test crate * `rustc_private` - everything else
2015-01-21Remove 'since' from unstable attributesBrian Anderson-1/+1
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-1/+1
2015-01-17Register new snapshots.Eduard Burtescu-2/+2
2015-01-12Add note about TLS lookups in random()Steve Klabnik-1/+26
Fixes #16072
2015-01-08Improvements to feature stagingBrian Anderson-1/+1
This gets rid of the 'experimental' level, removes the non-staged_api case (i.e. stability levels for out-of-tree crates), and lets the staged_api attributes use 'unstable' and 'deprecated' lints. This makes the transition period to the full feature staging design a bit nicer.
2015-01-07Test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-08Rename `target_word_size` to `target_pointer_width`Nick Cameron-2/+2
Closes #20421 [breaking-change]