1# Changelog
2All notable changes to this project will be documented in this file.
3
4The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
7A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md).
8
9You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful.
10
11
12## [0.6.5] - 2019-01-28
13### Crates
14- Update `rand_core` to 0.4 (#703)
15- Move `JitterRng` to its own crate (#685)
16- Add a warm-bindgen test crate (#696)
17
18### Platforms
19- Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng
20
21### Doc
22- Use RFC 1946 for doc links (#691)
23- Fix some doc links and notes (#711)
24
25## [0.6.4] - 2019-01-08
26### Fixes
27- Move wasm-bindgen shims to correct crate (#686)
28- Make `wasm32-unknown-unknown` compile but fail at run-time if missing bindingsg (#686)
29
30## [0.6.3] - 2019-01-04
31### Fixes
32- Make the `std` feature require the optional `rand_os` dependency (#675)
33- Re-export the optional WASM dependencies of `rand_os` from `rand` to avoid breakage (#674)
34
35## [0.6.2] - 2019-01-04
36### Additions
37- Add `Default` for `ThreadRng` (#657)
38- Move `rngs::OsRng` to `rand_os` sub-crate; clean up code; use as dependency (#643) ##BLOCKER##
39- Add `rand_xoshiro` sub-crate, plus benchmarks (#642, #668)
40
41### Fixes
42- Fix bias in `UniformInt::sample_single` (#662)
43- Use `autocfg` instead of `rustc_version` for rustc version detection (#664)
44- Disable `i128` and `u128` if the `target_os` is `emscripten` (#671: work-around Emscripten limitation)
45- CI fixes (#660, #671)
46
47### Optimisations
48- Optimise memory usage of `UnitCircle` and `UnitSphereSurface` distributions (no PR)
49
50## [0.6.1] - 2018-11-22
51- Support sampling `Duration` also for `no_std` (only since Rust 1.25) (#649)
52- Disable default features of `libc` (#647)
53
54## [0.6.0] - 2018-11-14
55
56### Project organisation
57- Rand has moved from [rust-lang-nursery](https://github.com/rust-lang-nursery/rand)
58  to [rust-random](https://github.com/rust-random/rand)! (#578)
59- Created [The Rust Random Book](https://rust-random.github.io/book/)
60  ([source](https://github.com/rust-random/book))
61- Update copyright and licence notices (#591, #611)
62- Migrate policy documentation from the wiki (#544)
63
64### Platforms
65- Add fork protection on Unix (#466)
66- Added support for wasm-bindgen. (#541, #559, #562, #600)
67- Enable `OsRng` for powerpc64, sparc and sparc64 (#609)
68- Use `syscall` from `libc` on Linux instead of redefining it (#629)
69
70### RNGs
71- Switch `SmallRng` to use PCG (#623)
72- Implement `Pcg32` and `Pcg64Mcg` generators (#632)
73- Move ISAAC RNGs to a dedicated crate (#551)
74- Move Xorshift RNG to its own crate (#557)
75- Move ChaCha and HC128 RNGs to dedicated crates (#607, #636)
76- Remove usage of `Rc` from `ThreadRng` (#615)
77
78### Sampling and distributions
79- Implement `Rng.gen_ratio()` and `Bernoulli::new_ratio()` (#491)
80- Make `Uniform` strictly respect `f32` / `f64` high/low bounds (#477)
81- Allow `gen_range` and `Uniform` to work on non-`Copy` types (#506)
82- `Uniform` supports inclusive ranges: `Uniform::from(a..=b)`. This is
83  automatically enabled for Rust >= 1.27. (#566)
84- Implement `TrustedLen` and `FusedIterator` for `DistIter` (#620)
85
86#### New distributions
87- Add the `Dirichlet` distribution (#485)
88- Added sampling from the unit sphere and circle. (#567)
89- Implement the triangular distribution (#575)
90- Implement the Weibull distribution (#576)
91- Implement the Beta distribution (#574)
92
93#### Optimisations
94
95- Optimise `Bernoulli::new` (#500)
96- Optimise `char` sampling (#519)
97- Optimise sampling of `std::time::Duration` (#583)
98
99### Sequences
100- Redesign the `seq` module (#483, #515)
101- Add `WeightedIndex` and `choose_weighted` (#518, #547)
102- Optimised and changed return type of the `sample_indices` function. (#479)
103- Use `Iterator::size_hint()` to speed up `IteratorRandom::choose` (#593)
104
105### SIMD
106- Support for generating SIMD types (#523, #542, #561, #630)
107
108### Other
109- Revise CI scripts (#632, #635)
110- Remove functionality already deprecated in 0.5 (#499)
111- Support for `i128` and `u128` is automatically enabled for Rust >= 1.26. This
112  renders the `i128_support` feature obsolete. It still exists for backwards
113  compatibility but does not have any effect. This breaks programs using Rand
114  with `i128_support` on nightlies older than Rust 1.26. (#571)
115
116
117## [0.5.5] - 2018-08-07
118### Documentation
119- Fix links in documentation (#582)
120
121
122## [0.5.4] - 2018-07-11
123### Platform support
124- Make `OsRng` work via WASM/stdweb for WebWorkers
125
126
127## [0.5.3] - 2018-06-26
128### Platform support
129- OpenBSD, Bitrig: fix compilation (broken in 0.5.1) (#530)
130
131
132## [0.5.2] - 2018-06-18
133### Platform support
134- Hide `OsRng` and `JitterRng` on unsupported platforms (#512; fixes #503).
135
136
137## [0.5.1] - 2018-06-08
138
139### New distributions
140- Added Cauchy distribution. (#474, #486)
141- Added Pareto distribution. (#495)
142
143### Platform support and `OsRng`
144- Remove blanket Unix implementation. (#484)
145- Remove Wasm unimplemented stub. (#484)
146- Dragonfly BSD: read from `/dev/random`. (#484)
147- Bitrig: use `getentropy` like OpenBSD. (#484)
148- Solaris: (untested) use `getrandom` if available, otherwise `/dev/random`. (#484)
149- Emscripten, `stdweb`: split the read up in chunks. (#484)
150- Emscripten, Haiku: don't do an extra blocking read from `/dev/random`. (#484)
151- Linux, NetBSD, Solaris: read in blocking mode on first use in `fill_bytes`. (#484)
152- Fuchsia, CloudABI: fix compilation (broken in Rand 0.5). (#484)
153
154
155## [0.5.0] - 2018-05-21
156
157### Crate features and organisation
158- Minimum Rust version update: 1.22.0. (#239)
159- Create a separate `rand_core` crate. (#288)
160- Deprecate `rand_derive`. (#256)
161- Add `prelude` (and module reorganisation). (#435)
162- Add `log` feature. Logging is now available in `JitterRng`, `OsRng`, `EntropyRng` and `ReseedingRng`. (#246)
163- Add `serde1` feature for some PRNGs. (#189)
164- `stdweb` feature for `OsRng` support on WASM via stdweb. (#272, #336)
165
166### `Rng` trait
167- Split `Rng` in `RngCore` and `Rng` extension trait.
168  `next_u32`, `next_u64` and `fill_bytes` are now part of `RngCore`. (#265)
169- Add `Rng::sample`. (#256)
170- Deprecate `Rng::gen_weighted_bool`. (#308)
171- Add `Rng::gen_bool`. (#308)
172- Remove `Rng::next_f32` and `Rng::next_f64`. (#273)
173- Add optimized `Rng::fill` and `Rng::try_fill` methods. (#247)
174- Deprecate `Rng::gen_iter`. (#286)
175- Deprecate `Rng::gen_ascii_chars`. (#279)
176
177### `rand_core` crate
178- `rand` now depends on new `rand_core` crate (#288)
179- `RngCore` and `SeedableRng` are now part of `rand_core`. (#288)
180- Add modules to help implementing RNGs `impl` and `le`. (#209, #228)
181- Add `Error` and `ErrorKind`. (#225)
182- Add `CryptoRng` marker trait. (#273)
183- Add `BlockRngCore` trait. (#281)
184- Add `BlockRng` and `BlockRng64` wrappers to help implementations. (#281, #325)
185- Revise the `SeedableRng` trait. (#233)
186- Remove default implementations for `RngCore::next_u64` and `RngCore::fill_bytes`. (#288)
187- Add `RngCore::try_fill_bytes`. (#225)
188
189### Other traits and types
190- Add `FromEntropy` trait. (#233, #375)
191- Add `SmallRng` wrapper. (#296)
192- Rewrite `ReseedingRng` to only work with `BlockRngCore` (substantial performance improvement). (#281)
193- Deprecate `weak_rng`. Use `SmallRng` instead. (#296)
194- Deprecate `AsciiGenerator`. (#279)
195
196### Random number generators
197- Switch `StdRng` and `thread_rng` to HC-128. (#277)
198- `StdRng` must now be created with `from_entropy` instead of `new`
199- Change `thread_rng` reseeding threshold to 32 MiB. (#277)
200- PRNGs no longer implement `Copy`. (#209)
201- `Debug` implementations no longer show internals. (#209)
202- Implement `Clone` for `ReseedingRng`, `JitterRng`, OsRng`. (#383, #384)
203- Implement serialization for `XorShiftRng`, `IsaacRng` and `Isaac64Rng` under the `serde1` feature. (#189)
204- Implement `BlockRngCore` for `ChaChaCore` and `Hc128Core`. (#281)
205- All PRNGs are now portable across big- and little-endian architectures. (#209)
206- `Isaac64Rng::next_u32` no longer throws away half the results. (#209)
207- Add `IsaacRng::new_from_u64` and `Isaac64Rng::new_from_u64`. (#209)
208- Add the HC-128 CSPRNG `Hc128Rng`. (#210)
209- Change ChaCha20 to have 64-bit counter and 64-bit stream. (#349)
210- Changes to `JitterRng` to get its size down from 2112 to 24 bytes. (#251)
211- Various performance improvements to all PRNGs.
212
213### Platform support and `OsRng`
214- Add support for CloudABI. (#224)
215- Remove support for NaCl. (#225)
216- WASM support for `OsRng` via stdweb, behind the `stdweb` feature. (#272, #336)
217- Use `getrandom` on more platforms for Linux, and on Android. (#338)
218- Use the `SecRandomCopyBytes` interface on macOS. (#322)
219- On systems that do not have a syscall interface, only keep a single file descriptor open for `OsRng`. (#239)
220- On Unix, first try a single read from `/dev/random`, then `/dev/urandom`. (#338)
221- Better error handling and reporting in `OsRng` (using new error type). (#225)
222- `OsRng` now uses non-blocking when available. (#225)
223- Add `EntropyRng`, which provides `OsRng`, but has `JitterRng` as a fallback. (#235)
224
225### Distributions
226- New `Distribution` trait. (#256)
227- Add `Distribution::sample_iter` and `Rng::::sample_iter`. (#361)
228- Deprecate `Rand`, `Sample` and `IndependentSample` traits. (#256)
229- Add a `Standard` distribution (replaces most `Rand` implementations). (#256)
230- Add `Binomial` and `Poisson` distributions. (#96)
231- Add `Bernoulli` dsitribution. (#411)
232- Add `Alphanumeric` distribution. (#279)
233- Remove `Closed01` distribution, add `OpenClosed01`. (#274, #420)
234- Rework `Range` type, making it possible to implement it for user types. (#274)
235- Rename `Range` to `Uniform`. (#395)
236- Add `Uniform::new_inclusive` for inclusive ranges. (#274)
237- Use widening multiply method for much faster integer range reduction. (#274)
238- `Standard` distribution for `char` uses `Uniform` internally. (#274)
239- `Standard` distribution for `bool` uses sign test. (#274)
240- Implement `Standard` distribution for `Wrapping<T>`. (#436)
241- Implement `Uniform` distribution for `Duration`. (#427)
242
243
244## [0.4.3] - 2018-08-16
245### Fixed
246- Use correct syscall number for PowerPC (#589)
247
248
249## [0.4.2] - 2018-01-06
250### Changed
251- Use `winapi` on Windows
252- Update for Fuchsia OS
253- Remove dev-dependency on `log`
254
255
256## [0.4.1] - 2017-12-17
257### Added
258- `no_std` support
259
260
261## [0.4.0-pre.0] - 2017-12-11
262### Added
263- `JitterRng` added as a high-quality alternative entropy source using the
264  system timer
265- new `seq` module with `sample_iter`, `sample_slice`, etc.
266- WASM support via dummy implementations (fail at run-time)
267- Additional benchmarks, covering generators and new seq code
268
269### Changed
270- `thread_rng` uses `JitterRng` if seeding from system time fails
271  (slower but more secure than previous method)
272
273### Deprecated
274  - `sample` function deprecated (replaced by `sample_iter`)
275
276
277## [0.3.20] - 2018-01-06
278### Changed
279- Remove dev-dependency on `log`
280- Update `fuchsia-zircon` dependency to 0.3.2
281
282
283## [0.3.19] - 2017-12-27
284### Changed
285- Require `log <= 0.3.8` for dev builds
286- Update `fuchsia-zircon` dependency to 0.3
287- Fix broken links in docs (to unblock compiler docs testing CI)
288
289
290## [0.3.18] - 2017-11-06
291### Changed
292- `thread_rng` is seeded from the system time if `OsRng` fails
293- `weak_rng` now uses `thread_rng` internally
294
295
296## [0.3.17] - 2017-10-07
297### Changed
298 - Fuchsia: Magenta was renamed Zircon
299
300## [0.3.16] - 2017-07-27
301### Added
302- Implement Debug for mote non-public types
303- implement `Rand` for (i|u)i128
304- Support for Fuchsia
305
306### Changed
307- Add inline attribute to SampleRange::construct_range.
308  This improves the benchmark for sample in 11% and for shuffle in 16%.
309- Use `RtlGenRandom` instead of `CryptGenRandom`
310
311
312## [0.3.15] - 2016-11-26
313### Added
314- Add `Rng` trait method `choose_mut`
315- Redox support
316
317### Changed
318- Use `arc4rand` for `OsRng` on FreeBSD.
319- Use `arc4random(3)` for `OsRng` on OpenBSD.
320
321### Fixed
322- Fix filling buffers 4 GiB or larger with `OsRng::fill_bytes` on Windows
323
324
325## [0.3.14] - 2016-02-13
326### Fixed
327- Inline definitions from winapi/advapi32, wich decreases build times
328
329
330## [0.3.13] - 2016-01-09
331### Fixed
332- Compatible with Rust 1.7.0-nightly (needed some extra type annotations)
333
334
335## [0.3.12] - 2015-11-09
336### Changed
337- Replaced the methods in `next_f32` and `next_f64` with the technique described
338  Saito & Matsumoto at MCQMC'08. The new method should exhibit a slightly more
339  uniform distribution.
340- Depend on libc 0.2
341
342### Fixed
343- Fix iterator protocol issue in `rand::sample`
344
345
346## [0.3.11] - 2015-08-31
347### Added
348- Implement `Rand` for arrays with n <= 32
349
350
351## [0.3.10] - 2015-08-17
352### Added
353- Support for NaCl platforms
354
355### Changed
356- Allow `Rng` to be `?Sized`, impl for `&mut R` and `Box<R>` where `R: ?Sized + Rng`
357
358
359## [0.3.9] - 2015-06-18
360### Changed
361- Use `winapi` for Windows API things
362
363### Fixed
364- Fixed test on stable/nightly
365- Fix `getrandom` syscall number for aarch64-unknown-linux-gnu
366
367
368## [0.3.8] - 2015-04-23
369### Changed
370- `log` is a dev dependency
371
372### Fixed
373- Fix race condition of atomics in `is_getrandom_available`
374
375
376## [0.3.7] - 2015-04-03
377### Fixed
378- Derive Copy/Clone changes
379
380
381## [0.3.6] - 2015-04-02
382### Changed
383- Move to stable Rust!
384
385
386## [0.3.5] - 2015-04-01
387### Fixed
388- Compatible with Rust master
389
390
391## [0.3.4] - 2015-03-31
392### Added
393- Implement Clone for `Weighted`
394
395### Fixed
396- Compatible with Rust master
397
398
399## [0.3.3] - 2015-03-26
400### Fixed
401- Fix compile on Windows
402
403
404## [0.3.2] - 2015-03-26
405
406
407## [0.3.1] - 2015-03-26
408### Fixed
409- Fix compile on Windows
410
411
412## [0.3.0] - 2015-03-25
413### Changed
414- Update to use log version 0.3.x
415
416
417## [0.2.1] - 2015-03-22
418### Fixed
419- Compatible with Rust master
420- Fixed iOS compilation
421
422
423## [0.2.0] - 2015-03-06
424### Fixed
425- Compatible with Rust master (move from `old_io` to `std::io`)
426
427
428## [0.1.4] - 2015-03-04
429### Fixed
430- Compatible with Rust master (use wrapping ops)
431
432
433## [0.1.3] - 2015-02-20
434### Fixed
435- Compatible with Rust master
436
437### Removed
438- Removed Copy implementations from RNGs
439
440
441## [0.1.2] - 2015-02-03
442### Added
443- Imported functionality from `std::rand`, including:
444  - `StdRng`, `SeedableRng`, `TreadRng`, `weak_rng()`
445  - `ReaderRng`: A wrapper around any Reader to treat it as an RNG.
446- Imported documentation from `std::rand`
447- Imported tests from `std::rand`
448
449
450## [0.1.1] - 2015-02-03
451### Added
452- Migrate to a cargo-compatible directory structure.
453
454### Fixed
455- Do not use entropy during `gen_weighted_bool(1)`
456
457
458## [Rust 0.12.0] - 2014-10-09
459### Added
460- Impl Rand for tuples of arity 11 and 12
461- Include ChaCha pseudorandom generator
462- Add `next_f64` and `next_f32` to Rng
463- Implement Clone for PRNGs
464
465### Changed
466- Rename `TaskRng` to `ThreadRng` and `task_rng` to `thread_rng` (since a
467  runtime is removed from Rust).
468
469### Fixed
470- Improved performance of ISAAC and ISAAC64 by 30% and 12 % respectively, by
471  informing the optimiser that indexing is never out-of-bounds.
472
473### Removed
474- Removed the Deprecated `choose_option`
475
476
477## [Rust 0.11.0] - 2014-07-02
478### Added
479- document when to use `OSRng` in cryptographic context, and explain why we use `/dev/urandom` instead of `/dev/random`
480- `Rng::gen_iter()` which will return an infinite stream of random values
481- `Rng::gen_ascii_chars()` which will return an infinite stream of random ascii characters
482
483### Changed
484- Now only depends on libcore!
485- Remove `Rng.choose()`, rename `Rng.choose_option()` to `.choose()`
486- Rename OSRng to OsRng
487- The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`,
488  but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice
489  structure now has a lifetime associated with it.
490- The `sample` method on `Rng` has been moved to a top-level function in the
491  `rand` module due to its dependence on `Vec`.
492
493### Removed
494- `Rng::gen_vec()` was removed. Previous behavior can be regained with
495  `rng.gen_iter().take(n).collect()`
496- `Rng::gen_ascii_str()` was removed. Previous behavior can be regained with
497  `rng.gen_ascii_chars().take(n).collect()`
498- {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all
499  relied on being able to use an OSRng for seeding, but this is no longer
500  available in librand (where these types are defined). To retain the same
501  functionality, these types now implement the `Rand` trait so they can be
502  generated with a random seed from another random number generator. This allows
503  the stdlib to use an OSRng to create seeded instances of these RNGs.
504- Rand implementations for `Box<T>` and `@T` were removed. These seemed to be
505  pretty rare in the codebase, and it allows for librand to not depend on
506  liballoc.  Additionally, other pointer types like Rc<T> and Arc<T> were not
507  supported.
508- Remove a slew of old deprecated functions
509
510
511## [Rust 0.10] - 2014-04-03
512### Changed
513- replace `Rng.shuffle's` functionality with `.shuffle_mut`
514- bubble up IO errors when creating an OSRng
515
516### Fixed
517- Use `fill()` instead of `read()`
518- Rewrite OsRng in Rust for windows
519
520## [0.10-pre] - 2014-03-02
521### Added
522- Seperate `rand` out of the standard library
523