All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
A separate changelog is kept for rand_core.
You may also find the Upgrade Guide useful.
- The
Bernoullidistribution constructors now reports an error on NaN and ondenominator == 0. (#925) - Use
std::sync::Onceto register fork handler, avoiding possible atomicity violation (#928) - Fix documentation on the precision of generated floating-point values
- Unix: make libc dependency optional; only use fork protection with std feature (#928)
- Implement
std::error::ErrorforBernoulliError(#919)
- Fix dependency on
rand_core0.5.1 (#890)
- Unit tests for value stability of distributions added (#888)
This release was yanked since it depends on rand_core::OsRng added in 0.5.1
but specifies a dependency on version 0.5.0 (#890), causing a broken builds
when updating from rand 0.7.0 without also updating rand_core.
- Fix
no_stdbehaviour, appropriately enable c2-chacha'sstdfeature (#844) allocfeature inno_stdis available since Rust 1.36 (#856)- Fix or squelch issues from Clippy lints (#840)
- Add a
no_stdtarget to CI to continously evaluateno_stdstatus (#844) WeightedIndex: allow adjusting a sub-set of weights (#866)
- Fix incorrect pointer usages revealed by Miri testing (#780, #781)
- Fix (tiny!) bias in
Uniformfor 8- and 16-bit ints (#809)
- Bumped MSRV (min supported Rust version) to 1.32.0
- Updated to Rust Edition 2018 (#823, #824)
- Removed dependence on
rand_xorshift,rand_isaac,rand_jittercrates (#759, #765) - Remove dependency on
winapi(#724) - Removed all
build.rsfiles (#824) - Removed code already deprecated in version 0.6 (#757)
- Removed the serde1 feature (It's still available for backwards compatibility, but it does not do anything. #830)
- Many documentation changes
- Updated to
rand_core0.5.0 Errortype redesigned with new API (#800)- Move
from_entropymethod toSeedableRngand removeFromEntropy(#800) SeedableRng::from_rngis now expected to be value-stable (#815)
- OS interface moved from
rand_osto newgetrandomcrate (#765, getrandom) - Use ChaCha for
StdRngandThreadRng(#792) - Feature-gate
SmallRng(#792) ThreadRngnow supportsCopy(#758)- Deprecated
EntropyRng(#765) - Enable fork protection of ReseedingRng without
std(#724)
- Many distributions have been moved to
rand_distr(#761) Bernoulli::newconstructor now returns aResult(#803)Distribution::sample_iteradjusted for more flexibility (#758)- Added
distributions::weighted::alias_method::WeightedIndexforO(1)sampling (#692) - Support sampling
NonZeroU*types with theStandarddistribution (#728) - Optimised
Binomialdistribution sampling (#735, #740, #752) - Optimised SIMD float sampling (#739)
- Make results portable across 32- and 64-bit by using
u32samples forusizewhere possible (#809)
- Update
rand_coreto 0.4 (#703) - Move
JitterRngto its own crate (#685) - Add a wasm-bindgen test crate (#696)
- Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng
- Use RFC 1946 for doc links (#691)
- Fix some doc links and notes (#711)
- Move wasm-bindgen shims to correct crate (#686)
- Make
wasm32-unknown-unknowncompile but fail at run-time if missing bindingsg (#686)
- Make the
stdfeature require the optionalrand_osdependency (#675) - Re-export the optional WASM dependencies of
rand_osfromrandto avoid breakage (#674)
- Add
DefaultforThreadRng(#657) - Move
rngs::OsRngtorand_ossub-crate; clean up code; use as dependency (#643) ##BLOCKER## - Add
rand_xoshirosub-crate, plus benchmarks (#642, #668)
- Fix bias in
UniformInt::sample_single(#662) - Use
autocfginstead ofrustc_versionfor rustc version detection (#664) - Disable
i128andu128if thetarget_osisemscripten(#671: work-around Emscripten limitation) - CI fixes (#660, #671)
- Optimise memory usage of
UnitCircleandUnitSphereSurfacedistributions (no PR)
- Support sampling
Durationalso forno_std(only since Rust 1.25) (#649) - Disable default features of
libc(#647)
- Rand has moved from rust-lang-nursery to rust-random! (#578)
- Created The Rust Random Book (source)
- Update copyright and licence notices (#591, #611)
- Migrate policy documentation from the wiki (#544)
- Add fork protection on Unix (#466)
- Added support for wasm-bindgen. (#541, #559, #562, #600)
- Enable
OsRngfor powerpc64, sparc and sparc64 (#609) - Use
syscallfromlibcon Linux instead of redefining it (#629)
- Switch
SmallRngto use PCG (#623) - Implement
Pcg32andPcg64Mcggenerators (#632) - Move ISAAC RNGs to a dedicated crate (#551)
- Move Xorshift RNG to its own crate (#557)
- Move ChaCha and HC128 RNGs to dedicated crates (#607, #636)
- Remove usage of
RcfromThreadRng(#615)
- Implement
Rng.gen_ratio()andBernoulli::new_ratio()(#491) - Make
Uniformstrictly respectf32/f64high/low bounds (#477) - Allow
gen_rangeandUniformto work on non-Copytypes (#506) Uniformsupports inclusive ranges:Uniform::from(a..=b). This is automatically enabled for Rust >= 1.27. (#566)- Implement
TrustedLenandFusedIteratorforDistIter(#620)
- Add the
Dirichletdistribution (#485) - Added sampling from the unit sphere and circle. (#567)
- Implement the triangular distribution (#575)
- Implement the Weibull distribution (#576)
- Implement the Beta distribution (#574)
- Optimise
Bernoulli::new(#500) - Optimise
charsampling (#519) - Optimise sampling of
std::time::Duration(#583)
- Redesign the
seqmodule (#483, #515) - Add
WeightedIndexandchoose_weighted(#518, #547) - Optimised and changed return type of the
sample_indicesfunction. (#479) - Use
Iterator::size_hint()to speed upIteratorRandom::choose(#593)
- Support for generating SIMD types (#523, #542, #561, #630)
- Revise CI scripts (#632, #635)
- Remove functionality already deprecated in 0.5 (#499)
- Support for
i128andu128is automatically enabled for Rust >= 1.26. This renders thei128_supportfeature obsolete. It still exists for backwards compatibility but does not have any effect. This breaks programs using Rand withi128_supporton nightlies older than Rust 1.26. (#571)
- Fix links in documentation (#582)
- Make
OsRngwork via WASM/stdweb for WebWorkers
- OpenBSD, Bitrig: fix compilation (broken in 0.5.1) (#530)
- Hide
OsRngandJitterRngon unsupported platforms (#512; fixes #503).
- Added Cauchy distribution. (#474, #486)
- Added Pareto distribution. (#495)
- Remove blanket Unix implementation. (#484)
- Remove Wasm unimplemented stub. (#484)
- Dragonfly BSD: read from
/dev/random. (#484) - Bitrig: use
getentropylike OpenBSD. (#484) - Solaris: (untested) use
getrandomif available, otherwise/dev/random. (#484) - Emscripten,
stdweb: split the read up in chunks. (#484) - Emscripten, Haiku: don't do an extra blocking read from
/dev/random. (#484) - Linux, NetBSD, Solaris: read in blocking mode on first use in
fill_bytes. (#484) - Fuchsia, CloudABI: fix compilation (broken in Rand 0.5). (#484)
- Minimum Rust version update: 1.22.0. (#239)
- Create a separate
rand_corecrate. (#288) - Deprecate
rand_derive. (#256) - Add
prelude(and module reorganisation). (#435) - Add
logfeature. Logging is now available inJitterRng,OsRng,EntropyRngandReseedingRng. (#246) - Add
serde1feature for some PRNGs. (#189) stdwebfeature forOsRngsupport on WASM via stdweb. (#272, #336)
- Split
RnginRngCoreandRngextension trait.next_u32,next_u64andfill_bytesare now part ofRngCore. (#265) - Add
Rng::sample. (#256) - Deprecate
Rng::gen_weighted_bool. (#308) - Add
Rng::gen_bool. (#308) - Remove
Rng::next_f32andRng::next_f64. (#273) - Add optimized
Rng::fillandRng::try_fillmethods. (#247) - Deprecate
Rng::gen_iter. (#286) - Deprecate
Rng::gen_ascii_chars. (#279)
randnow depends on newrand_corecrate (#288)RngCoreandSeedableRngare now part ofrand_core. (#288)- Add modules to help implementing RNGs
implandle. (#209, #228) - Add
ErrorandErrorKind. (#225) - Add
CryptoRngmarker trait. (#273) - Add
BlockRngCoretrait. (#281) - Add
BlockRngandBlockRng64wrappers to help implementations. (#281, #325) - Revise the
SeedableRngtrait. (#233) - Remove default implementations for
RngCore::next_u64andRngCore::fill_bytes. (#288) - Add
RngCore::try_fill_bytes. (#225)
- Add
FromEntropytrait. (#233, #375) - Add
SmallRngwrapper. (#296) - Rewrite
ReseedingRngto only work withBlockRngCore(substantial performance improvement). (#281) - Deprecate
weak_rng. UseSmallRnginstead. (#296) - Deprecate
AsciiGenerator. (#279)
- Switch
StdRngandthread_rngto HC-128. (#277) StdRngmust now be created withfrom_entropyinstead ofnew- Change
thread_rngreseeding threshold to 32 MiB. (#277) - PRNGs no longer implement
Copy. (#209) Debugimplementations no longer show internals. (#209)- Implement
CloneforReseedingRng,JitterRng, OsRng`. (#383, #384) - Implement serialization for
XorShiftRng,IsaacRngandIsaac64Rngunder theserde1feature. (#189) - Implement
BlockRngCoreforChaChaCoreandHc128Core. (#281) - All PRNGs are now portable across big- and little-endian architectures. (#209)
Isaac64Rng::next_u32no longer throws away half the results. (#209)- Add
IsaacRng::new_from_u64andIsaac64Rng::new_from_u64. (#209) - Add the HC-128 CSPRNG
Hc128Rng. (#210) - Change ChaCha20 to have 64-bit counter and 64-bit stream. (#349)
- Changes to
JitterRngto get its size down from 2112 to 24 bytes. (#251) - Various performance improvements to all PRNGs.
- Add support for CloudABI. (#224)
- Remove support for NaCl. (#225)
- WASM support for
OsRngvia stdweb, behind thestdwebfeature. (#272, #336) - Use
getrandomon more platforms for Linux, and on Android. (#338) - Use the
SecRandomCopyBytesinterface on macOS. (#322) - On systems that do not have a syscall interface, only keep a single file descriptor open for
OsRng. (#239) - On Unix, first try a single read from
/dev/random, then/dev/urandom. (#338) - Better error handling and reporting in
OsRng(using new error type). (#225) OsRngnow uses non-blocking when available. (#225)- Add
EntropyRng, which providesOsRng, but hasJitterRngas a fallback. (#235)
- New
Distributiontrait. (#256) - Add
Distribution::sample_iterandRng::::sample_iter. (#361) - Deprecate
Rand,SampleandIndependentSampletraits. (#256) - Add a
Standarddistribution (replaces mostRandimplementations). (#256) - Add
BinomialandPoissondistributions. (#96) - Add
Bernoullidsitribution. (#411) - Add
Alphanumericdistribution. (#279) - Remove
Closed01distribution, addOpenClosed01. (#274, #420) - Rework
Rangetype, making it possible to implement it for user types. (#274) - Rename
RangetoUniform. (#395) - Add
Uniform::new_inclusivefor inclusive ranges. (#274) - Use widening multiply method for much faster integer range reduction. (#274)
Standarddistribution forcharusesUniforminternally. (#274)Standarddistribution forbooluses sign test. (#274)- Implement
Standarddistribution forWrapping<T>. (#436) - Implement
Uniformdistribution forDuration. (#427)
- Use correct syscall number for PowerPC (#589)
- Use
winapion Windows - Update for Fuchsia OS
- Remove dev-dependency on
log
no_stdsupport
JitterRngadded as a high-quality alternative entropy source using the system timer- new
seqmodule withsample_iter,sample_slice, etc. - WASM support via dummy implementations (fail at run-time)
- Additional benchmarks, covering generators and new seq code
thread_rngusesJitterRngif seeding from system time fails (slower but more secure than previous method)
samplefunction deprecated (replaced bysample_iter)
- Remove dev-dependency on
log - Update
fuchsia-zircondependency to 0.3.2
- Require
log <= 0.3.8for dev builds - Update
fuchsia-zircondependency to 0.3 - Fix broken links in docs (to unblock compiler docs testing CI)
thread_rngis seeded from the system time ifOsRngfailsweak_rngnow usesthread_rnginternally
- Fuchsia: Magenta was renamed Zircon
- Implement Debug for mote non-public types
- implement
Randfor (i|u)i128 - Support for Fuchsia
- Add inline attribute to SampleRange::construct_range. This improves the benchmark for sample in 11% and for shuffle in 16%.
- Use
RtlGenRandominstead ofCryptGenRandom
- Add
Rngtrait methodchoose_mut - Redox support
- Use
arc4randforOsRngon FreeBSD. - Use
arc4random(3)forOsRngon OpenBSD.
- Fix filling buffers 4 GiB or larger with
OsRng::fill_byteson Windows
- Inline definitions from winapi/advapi32, wich decreases build times
- Compatible with Rust 1.7.0-nightly (needed some extra type annotations)
- Replaced the methods in
next_f32andnext_f64with the technique described Saito & Matsumoto at MCQMC'08. The new method should exhibit a slightly more uniform distribution. - Depend on libc 0.2
- Fix iterator protocol issue in
rand::sample
- Implement
Randfor arrays with n <= 32
- Support for NaCl platforms
- Allow
Rngto be?Sized, impl for&mut RandBox<R>whereR: ?Sized + Rng
- Use
winapifor Windows API things
- Fixed test on stable/nightly
- Fix
getrandomsyscall number for aarch64-unknown-linux-gnu
logis a dev dependency
- Fix race condition of atomics in
is_getrandom_available
- Derive Copy/Clone changes
- Move to stable Rust!
- Compatible with Rust master
- Implement Clone for
Weighted
- Compatible with Rust master
- Fix compile on Windows
- Fix compile on Windows
- Update to use log version 0.3.x
- Compatible with Rust master
- Fixed iOS compilation
- Compatible with Rust master (move from
old_iotostd::io)
- Compatible with Rust master (use wrapping ops)
- Compatible with Rust master
- Removed Copy implementations from RNGs
- Imported functionality from
std::rand, including:StdRng,SeedableRng,TreadRng,weak_rng()ReaderRng: A wrapper around any Reader to treat it as an RNG.
- Imported documentation from
std::rand - Imported tests from
std::rand
- Migrate to a cargo-compatible directory structure.
- Do not use entropy during
gen_weighted_bool(1)
- Impl Rand for tuples of arity 11 and 12
- Include ChaCha pseudorandom generator
- Add
next_f64andnext_f32to Rng - Implement Clone for PRNGs
- Rename
TaskRngtoThreadRngandtask_rngtothread_rng(since a runtime is removed from Rust).
- Improved performance of ISAAC and ISAAC64 by 30% and 12 % respectively, by informing the optimiser that indexing is never out-of-bounds.
- Removed the Deprecated
choose_option
- document when to use
OSRngin cryptographic context, and explain why we use/dev/urandominstead of/dev/random Rng::gen_iter()which will return an infinite stream of random valuesRng::gen_ascii_chars()which will return an infinite stream of random ascii characters
- Now only depends on libcore!
- Remove
Rng.choose(), renameRng.choose_option()to.choose() - Rename OSRng to OsRng
- The WeightedChoice structure is no longer built with a
Vec<Weighted<T>>, but rather a&mut [Weighted<T>]. This means that the WeightedChoice structure now has a lifetime associated with it. - The
samplemethod onRnghas been moved to a top-level function in therandmodule due to its dependence onVec.
Rng::gen_vec()was removed. Previous behavior can be regained withrng.gen_iter().take(n).collect()Rng::gen_ascii_str()was removed. Previous behavior can be regained withrng.gen_ascii_chars().take(n).collect()- {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all
relied on being able to use an OSRng for seeding, but this is no longer
available in librand (where these types are defined). To retain the same
functionality, these types now implement the
Randtrait so they can be generated with a random seed from another random number generator. This allows the stdlib to use an OSRng to create seeded instances of these RNGs. - Rand implementations for
Box<T>and@Twere removed. These seemed to be pretty rare in the codebase, and it allows for librand to not depend on liballoc. Additionally, other pointer types like Rc and Arc were not supported. - Remove a slew of old deprecated functions
- replace
Rng.shuffle'sfunctionality with.shuffle_mut - bubble up IO errors when creating an OSRng
- Use
fill()instead ofread() - Rewrite OsRng in Rust for windows
- Seperate
randout of the standard library