2 All notable changes to this project will be documented in this file.
4 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md).
9 You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful.
11 ## [0.7.2] - 2019-09-16
13 - Fix dependency on `rand_core` 0.5.1 (#890)
16 - Unit tests for value stability of distributions added (#888)
18 ## [0.7.1] - 2019-09-13
20 - Fix `no_std` behaviour, appropriately enable c2-chacha's `std` feature (#844)
21 - `alloc` feature in `no_std` is available since Rust 1.36 (#856)
22 - Fix or squelch issues from Clippy lints (#840)
25 - Add a `no_std` target to CI to continously evaluate `no_std` status (#844)
26 - `WeightedIndex`: allow adjusting a sub-set of weights (#866)
28 ## [0.7.0] - 2019-06-28
31 - Fix incorrect pointer usages revealed by Miri testing (#780, #781)
32 - Fix (tiny!) bias in `Uniform` for 8- and 16-bit ints (#809)
35 - Bumped MSRV (min supported Rust version) to 1.32.0
36 - Updated to Rust Edition 2018 (#823, #824)
37 - Removed dependence on `rand_xorshift`, `rand_isaac`, `rand_jitter` crates (#759, #765)
38 - Remove dependency on `winapi` (#724)
39 - Removed all `build.rs` files (#824)
40 - Removed code already deprecated in version 0.6 (#757)
41 - Removed the serde1 feature (It's still available for backwards compatibility, but it does not do anything. #830)
42 - Many documentation changes
45 - Updated to `rand_core` 0.5.0
46 - `Error` type redesigned with new API (#800)
47 - Move `from_entropy` method to `SeedableRng` and remove `FromEntropy` (#800)
48 - `SeedableRng::from_rng` is now expected to be value-stable (#815)
51 - OS interface moved from `rand_os` to new `getrandom` crate (#765, [getrandom](https://github.com/rust-random/getrandom))
52 - Use ChaCha for `StdRng` and `ThreadRng` (#792)
53 - Feature-gate `SmallRng` (#792)
54 - `ThreadRng` now supports `Copy` (#758)
55 - Deprecated `EntropyRng` (#765)
56 - Enable fork protection of ReseedingRng without `std` (#724)
59 - Many distributions have been moved to `rand_distr` (#761)
60 - `Bernoulli::new` constructor now returns a `Result` (#803)
61 - `Distribution::sample_iter` adjusted for more flexibility (#758)
62 - Added `distributions::weighted::alias_method::WeightedIndex` for `O(1)` sampling (#692)
63 - Support sampling `NonZeroU*` types with the `Standard` distribution (#728)
64 - Optimised `Binomial` distribution sampling (#735, #740, #752)
65 - Optimised SIMD float sampling (#739)
68 - Make results portable across 32- and 64-bit by using `u32` samples for `usize` where possible (#809)
70 ## [0.6.5] - 2019-01-28
72 - Update `rand_core` to 0.4 (#703)
73 - Move `JitterRng` to its own crate (#685)
74 - Add a wasm-bindgen test crate (#696)
77 - Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng
80 - Use RFC 1946 for doc links (#691)
81 - Fix some doc links and notes (#711)
83 ## [0.6.4] - 2019-01-08
85 - Move wasm-bindgen shims to correct crate (#686)
86 - Make `wasm32-unknown-unknown` compile but fail at run-time if missing bindingsg (#686)
88 ## [0.6.3] - 2019-01-04
90 - Make the `std` feature require the optional `rand_os` dependency (#675)
91 - Re-export the optional WASM dependencies of `rand_os` from `rand` to avoid breakage (#674)
93 ## [0.6.2] - 2019-01-04
95 - Add `Default` for `ThreadRng` (#657)
96 - Move `rngs::OsRng` to `rand_os` sub-crate; clean up code; use as dependency (#643) ##BLOCKER##
97 - Add `rand_xoshiro` sub-crate, plus benchmarks (#642, #668)
100 - Fix bias in `UniformInt::sample_single` (#662)
101 - Use `autocfg` instead of `rustc_version` for rustc version detection (#664)
102 - Disable `i128` and `u128` if the `target_os` is `emscripten` (#671: work-around Emscripten limitation)
103 - CI fixes (#660, #671)
106 - Optimise memory usage of `UnitCircle` and `UnitSphereSurface` distributions (no PR)
108 ## [0.6.1] - 2018-11-22
109 - Support sampling `Duration` also for `no_std` (only since Rust 1.25) (#649)
110 - Disable default features of `libc` (#647)
112 ## [0.6.0] - 2018-11-14
114 ### Project organisation
115 - Rand has moved from [rust-lang-nursery](https://github.com/rust-lang-nursery/rand)
116 to [rust-random](https://github.com/rust-random/rand)! (#578)
117 - Created [The Rust Random Book](https://rust-random.github.io/book/)
118 ([source](https://github.com/rust-random/book))
119 - Update copyright and licence notices (#591, #611)
120 - Migrate policy documentation from the wiki (#544)
123 - Add fork protection on Unix (#466)
124 - Added support for wasm-bindgen. (#541, #559, #562, #600)
125 - Enable `OsRng` for powerpc64, sparc and sparc64 (#609)
126 - Use `syscall` from `libc` on Linux instead of redefining it (#629)
129 - Switch `SmallRng` to use PCG (#623)
130 - Implement `Pcg32` and `Pcg64Mcg` generators (#632)
131 - Move ISAAC RNGs to a dedicated crate (#551)
132 - Move Xorshift RNG to its own crate (#557)
133 - Move ChaCha and HC128 RNGs to dedicated crates (#607, #636)
134 - Remove usage of `Rc` from `ThreadRng` (#615)
136 ### Sampling and distributions
137 - Implement `Rng.gen_ratio()` and `Bernoulli::new_ratio()` (#491)
138 - Make `Uniform` strictly respect `f32` / `f64` high/low bounds (#477)
139 - Allow `gen_range` and `Uniform` to work on non-`Copy` types (#506)
140 - `Uniform` supports inclusive ranges: `Uniform::from(a..=b)`. This is
141 automatically enabled for Rust >= 1.27. (#566)
142 - Implement `TrustedLen` and `FusedIterator` for `DistIter` (#620)
144 #### New distributions
145 - Add the `Dirichlet` distribution (#485)
146 - Added sampling from the unit sphere and circle. (#567)
147 - Implement the triangular distribution (#575)
148 - Implement the Weibull distribution (#576)
149 - Implement the Beta distribution (#574)
153 - Optimise `Bernoulli::new` (#500)
154 - Optimise `char` sampling (#519)
155 - Optimise sampling of `std::time::Duration` (#583)
158 - Redesign the `seq` module (#483, #515)
159 - Add `WeightedIndex` and `choose_weighted` (#518, #547)
160 - Optimised and changed return type of the `sample_indices` function. (#479)
161 - Use `Iterator::size_hint()` to speed up `IteratorRandom::choose` (#593)
164 - Support for generating SIMD types (#523, #542, #561, #630)
167 - Revise CI scripts (#632, #635)
168 - Remove functionality already deprecated in 0.5 (#499)
169 - Support for `i128` and `u128` is automatically enabled for Rust >= 1.26. This
170 renders the `i128_support` feature obsolete. It still exists for backwards
171 compatibility but does not have any effect. This breaks programs using Rand
172 with `i128_support` on nightlies older than Rust 1.26. (#571)
175 ## [0.5.5] - 2018-08-07
177 - Fix links in documentation (#582)
180 ## [0.5.4] - 2018-07-11
182 - Make `OsRng` work via WASM/stdweb for WebWorkers
185 ## [0.5.3] - 2018-06-26
187 - OpenBSD, Bitrig: fix compilation (broken in 0.5.1) (#530)
190 ## [0.5.2] - 2018-06-18
192 - Hide `OsRng` and `JitterRng` on unsupported platforms (#512; fixes #503).
195 ## [0.5.1] - 2018-06-08
197 ### New distributions
198 - Added Cauchy distribution. (#474, #486)
199 - Added Pareto distribution. (#495)
201 ### Platform support and `OsRng`
202 - Remove blanket Unix implementation. (#484)
203 - Remove Wasm unimplemented stub. (#484)
204 - Dragonfly BSD: read from `/dev/random`. (#484)
205 - Bitrig: use `getentropy` like OpenBSD. (#484)
206 - Solaris: (untested) use `getrandom` if available, otherwise `/dev/random`. (#484)
207 - Emscripten, `stdweb`: split the read up in chunks. (#484)
208 - Emscripten, Haiku: don't do an extra blocking read from `/dev/random`. (#484)
209 - Linux, NetBSD, Solaris: read in blocking mode on first use in `fill_bytes`. (#484)
210 - Fuchsia, CloudABI: fix compilation (broken in Rand 0.5). (#484)
213 ## [0.5.0] - 2018-05-21
215 ### Crate features and organisation
216 - Minimum Rust version update: 1.22.0. (#239)
217 - Create a separate `rand_core` crate. (#288)
218 - Deprecate `rand_derive`. (#256)
219 - Add `prelude` (and module reorganisation). (#435)
220 - Add `log` feature. Logging is now available in `JitterRng`, `OsRng`, `EntropyRng` and `ReseedingRng`. (#246)
221 - Add `serde1` feature for some PRNGs. (#189)
222 - `stdweb` feature for `OsRng` support on WASM via stdweb. (#272, #336)
225 - Split `Rng` in `RngCore` and `Rng` extension trait.
226 `next_u32`, `next_u64` and `fill_bytes` are now part of `RngCore`. (#265)
227 - Add `Rng::sample`. (#256)
228 - Deprecate `Rng::gen_weighted_bool`. (#308)
229 - Add `Rng::gen_bool`. (#308)
230 - Remove `Rng::next_f32` and `Rng::next_f64`. (#273)
231 - Add optimized `Rng::fill` and `Rng::try_fill` methods. (#247)
232 - Deprecate `Rng::gen_iter`. (#286)
233 - Deprecate `Rng::gen_ascii_chars`. (#279)
235 ### `rand_core` crate
236 - `rand` now depends on new `rand_core` crate (#288)
237 - `RngCore` and `SeedableRng` are now part of `rand_core`. (#288)
238 - Add modules to help implementing RNGs `impl` and `le`. (#209, #228)
239 - Add `Error` and `ErrorKind`. (#225)
240 - Add `CryptoRng` marker trait. (#273)
241 - Add `BlockRngCore` trait. (#281)
242 - Add `BlockRng` and `BlockRng64` wrappers to help implementations. (#281, #325)
243 - Revise the `SeedableRng` trait. (#233)
244 - Remove default implementations for `RngCore::next_u64` and `RngCore::fill_bytes`. (#288)
245 - Add `RngCore::try_fill_bytes`. (#225)
247 ### Other traits and types
248 - Add `FromEntropy` trait. (#233, #375)
249 - Add `SmallRng` wrapper. (#296)
250 - Rewrite `ReseedingRng` to only work with `BlockRngCore` (substantial performance improvement). (#281)
251 - Deprecate `weak_rng`. Use `SmallRng` instead. (#296)
252 - Deprecate `AsciiGenerator`. (#279)
254 ### Random number generators
255 - Switch `StdRng` and `thread_rng` to HC-128. (#277)
256 - `StdRng` must now be created with `from_entropy` instead of `new`
257 - Change `thread_rng` reseeding threshold to 32 MiB. (#277)
258 - PRNGs no longer implement `Copy`. (#209)
259 - `Debug` implementations no longer show internals. (#209)
260 - Implement `Clone` for `ReseedingRng`, `JitterRng`, OsRng`. (#383, #384)
261 - Implement serialization for `XorShiftRng`, `IsaacRng` and `Isaac64Rng` under the `serde1` feature. (#189)
262 - Implement `BlockRngCore` for `ChaChaCore` and `Hc128Core`. (#281)
263 - All PRNGs are now portable across big- and little-endian architectures. (#209)
264 - `Isaac64Rng::next_u32` no longer throws away half the results. (#209)
265 - Add `IsaacRng::new_from_u64` and `Isaac64Rng::new_from_u64`. (#209)
266 - Add the HC-128 CSPRNG `Hc128Rng`. (#210)
267 - Change ChaCha20 to have 64-bit counter and 64-bit stream. (#349)
268 - Changes to `JitterRng` to get its size down from 2112 to 24 bytes. (#251)
269 - Various performance improvements to all PRNGs.
271 ### Platform support and `OsRng`
272 - Add support for CloudABI. (#224)
273 - Remove support for NaCl. (#225)
274 - WASM support for `OsRng` via stdweb, behind the `stdweb` feature. (#272, #336)
275 - Use `getrandom` on more platforms for Linux, and on Android. (#338)
276 - Use the `SecRandomCopyBytes` interface on macOS. (#322)
277 - On systems that do not have a syscall interface, only keep a single file descriptor open for `OsRng`. (#239)
278 - On Unix, first try a single read from `/dev/random`, then `/dev/urandom`. (#338)
279 - Better error handling and reporting in `OsRng` (using new error type). (#225)
280 - `OsRng` now uses non-blocking when available. (#225)
281 - Add `EntropyRng`, which provides `OsRng`, but has `JitterRng` as a fallback. (#235)
284 - New `Distribution` trait. (#256)
285 - Add `Distribution::sample_iter` and `Rng::::sample_iter`. (#361)
286 - Deprecate `Rand`, `Sample` and `IndependentSample` traits. (#256)
287 - Add a `Standard` distribution (replaces most `Rand` implementations). (#256)
288 - Add `Binomial` and `Poisson` distributions. (#96)
289 - Add `Bernoulli` dsitribution. (#411)
290 - Add `Alphanumeric` distribution. (#279)
291 - Remove `Closed01` distribution, add `OpenClosed01`. (#274, #420)
292 - Rework `Range` type, making it possible to implement it for user types. (#274)
293 - Rename `Range` to `Uniform`. (#395)
294 - Add `Uniform::new_inclusive` for inclusive ranges. (#274)
295 - Use widening multiply method for much faster integer range reduction. (#274)
296 - `Standard` distribution for `char` uses `Uniform` internally. (#274)
297 - `Standard` distribution for `bool` uses sign test. (#274)
298 - Implement `Standard` distribution for `Wrapping<T>`. (#436)
299 - Implement `Uniform` distribution for `Duration`. (#427)
302 ## [0.4.3] - 2018-08-16
304 - Use correct syscall number for PowerPC (#589)
307 ## [0.4.2] - 2018-01-06
309 - Use `winapi` on Windows
310 - Update for Fuchsia OS
311 - Remove dev-dependency on `log`
314 ## [0.4.1] - 2017-12-17
319 ## [0.4.0-pre.0] - 2017-12-11
321 - `JitterRng` added as a high-quality alternative entropy source using the
323 - new `seq` module with `sample_iter`, `sample_slice`, etc.
324 - WASM support via dummy implementations (fail at run-time)
325 - Additional benchmarks, covering generators and new seq code
328 - `thread_rng` uses `JitterRng` if seeding from system time fails
329 (slower but more secure than previous method)
332 - `sample` function deprecated (replaced by `sample_iter`)
335 ## [0.3.20] - 2018-01-06
337 - Remove dev-dependency on `log`
338 - Update `fuchsia-zircon` dependency to 0.3.2
341 ## [0.3.19] - 2017-12-27
343 - Require `log <= 0.3.8` for dev builds
344 - Update `fuchsia-zircon` dependency to 0.3
345 - Fix broken links in docs (to unblock compiler docs testing CI)
348 ## [0.3.18] - 2017-11-06
350 - `thread_rng` is seeded from the system time if `OsRng` fails
351 - `weak_rng` now uses `thread_rng` internally
354 ## [0.3.17] - 2017-10-07
356 - Fuchsia: Magenta was renamed Zircon
358 ## [0.3.16] - 2017-07-27
360 - Implement Debug for mote non-public types
361 - implement `Rand` for (i|u)i128
362 - Support for Fuchsia
365 - Add inline attribute to SampleRange::construct_range.
366 This improves the benchmark for sample in 11% and for shuffle in 16%.
367 - Use `RtlGenRandom` instead of `CryptGenRandom`
370 ## [0.3.15] - 2016-11-26
372 - Add `Rng` trait method `choose_mut`
376 - Use `arc4rand` for `OsRng` on FreeBSD.
377 - Use `arc4random(3)` for `OsRng` on OpenBSD.
380 - Fix filling buffers 4 GiB or larger with `OsRng::fill_bytes` on Windows
383 ## [0.3.14] - 2016-02-13
385 - Inline definitions from winapi/advapi32, wich decreases build times
388 ## [0.3.13] - 2016-01-09
390 - Compatible with Rust 1.7.0-nightly (needed some extra type annotations)
393 ## [0.3.12] - 2015-11-09
395 - Replaced the methods in `next_f32` and `next_f64` with the technique described
396 Saito & Matsumoto at MCQMC'08. The new method should exhibit a slightly more
397 uniform distribution.
401 - Fix iterator protocol issue in `rand::sample`
404 ## [0.3.11] - 2015-08-31
406 - Implement `Rand` for arrays with n <= 32
409 ## [0.3.10] - 2015-08-17
411 - Support for NaCl platforms
414 - Allow `Rng` to be `?Sized`, impl for `&mut R` and `Box<R>` where `R: ?Sized + Rng`
417 ## [0.3.9] - 2015-06-18
419 - Use `winapi` for Windows API things
422 - Fixed test on stable/nightly
423 - Fix `getrandom` syscall number for aarch64-unknown-linux-gnu
426 ## [0.3.8] - 2015-04-23
428 - `log` is a dev dependency
431 - Fix race condition of atomics in `is_getrandom_available`
434 ## [0.3.7] - 2015-04-03
436 - Derive Copy/Clone changes
439 ## [0.3.6] - 2015-04-02
441 - Move to stable Rust!
444 ## [0.3.5] - 2015-04-01
446 - Compatible with Rust master
449 ## [0.3.4] - 2015-03-31
451 - Implement Clone for `Weighted`
454 - Compatible with Rust master
457 ## [0.3.3] - 2015-03-26
459 - Fix compile on Windows
462 ## [0.3.2] - 2015-03-26
465 ## [0.3.1] - 2015-03-26
467 - Fix compile on Windows
470 ## [0.3.0] - 2015-03-25
472 - Update to use log version 0.3.x
475 ## [0.2.1] - 2015-03-22
477 - Compatible with Rust master
478 - Fixed iOS compilation
481 ## [0.2.0] - 2015-03-06
483 - Compatible with Rust master (move from `old_io` to `std::io`)
486 ## [0.1.4] - 2015-03-04
488 - Compatible with Rust master (use wrapping ops)
491 ## [0.1.3] - 2015-02-20
493 - Compatible with Rust master
496 - Removed Copy implementations from RNGs
499 ## [0.1.2] - 2015-02-03
501 - Imported functionality from `std::rand`, including:
502 - `StdRng`, `SeedableRng`, `TreadRng`, `weak_rng()`
503 - `ReaderRng`: A wrapper around any Reader to treat it as an RNG.
504 - Imported documentation from `std::rand`
505 - Imported tests from `std::rand`
508 ## [0.1.1] - 2015-02-03
510 - Migrate to a cargo-compatible directory structure.
513 - Do not use entropy during `gen_weighted_bool(1)`
516 ## [Rust 0.12.0] - 2014-10-09
518 - Impl Rand for tuples of arity 11 and 12
519 - Include ChaCha pseudorandom generator
520 - Add `next_f64` and `next_f32` to Rng
521 - Implement Clone for PRNGs
524 - Rename `TaskRng` to `ThreadRng` and `task_rng` to `thread_rng` (since a
525 runtime is removed from Rust).
528 - Improved performance of ISAAC and ISAAC64 by 30% and 12 % respectively, by
529 informing the optimiser that indexing is never out-of-bounds.
532 - Removed the Deprecated `choose_option`
535 ## [Rust 0.11.0] - 2014-07-02
537 - document when to use `OSRng` in cryptographic context, and explain why we use `/dev/urandom` instead of `/dev/random`
538 - `Rng::gen_iter()` which will return an infinite stream of random values
539 - `Rng::gen_ascii_chars()` which will return an infinite stream of random ascii characters
542 - Now only depends on libcore!
543 - Remove `Rng.choose()`, rename `Rng.choose_option()` to `.choose()`
544 - Rename OSRng to OsRng
545 - The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`,
546 but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice
547 structure now has a lifetime associated with it.
548 - The `sample` method on `Rng` has been moved to a top-level function in the
549 `rand` module due to its dependence on `Vec`.
552 - `Rng::gen_vec()` was removed. Previous behavior can be regained with
553 `rng.gen_iter().take(n).collect()`
554 - `Rng::gen_ascii_str()` was removed. Previous behavior can be regained with
555 `rng.gen_ascii_chars().take(n).collect()`
556 - {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all
557 relied on being able to use an OSRng for seeding, but this is no longer
558 available in librand (where these types are defined). To retain the same
559 functionality, these types now implement the `Rand` trait so they can be
560 generated with a random seed from another random number generator. This allows
561 the stdlib to use an OSRng to create seeded instances of these RNGs.
562 - Rand implementations for `Box<T>` and `@T` were removed. These seemed to be
563 pretty rare in the codebase, and it allows for librand to not depend on
564 liballoc. Additionally, other pointer types like Rc<T> and Arc<T> were not
566 - Remove a slew of old deprecated functions
569 ## [Rust 0.10] - 2014-04-03
571 - replace `Rng.shuffle's` functionality with `.shuffle_mut`
572 - bubble up IO errors when creating an OSRng
575 - Use `fill()` instead of `read()`
576 - Rewrite OsRng in Rust for windows
578 ## [0.10-pre] - 2014-03-02
580 - Seperate `rand` out of the standard library