NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #5 most downloaded on crates.io
Core random number generator traits and tools for implementation.
Last release 1 months ago
02 Sep 2026
Release timing varies
gaps range from 2 weeks to 8 months
Most releases are documented
notes for 22 of 25 stable releases
4 versions withdrawn
withdrawn after publishing
9 years old
42 releases · first in 2017
This release includes a fix for a soundness bug; see #1763 .
rand crate in TryRng docs (#75)Full Changelog: v0.10.0...v0.10.1
One column per quarter.
The dependency on rand_chacha has been replaced with a dependency on chacha20 . This changes the implementation behind StdRng , but the output remains
rand_chacha has been replaced with a dependency on chacha20. This changes the implementation behind StdRng, but the output remains the same. There may be some API breakage when using the ChaCha-types directly as these are now the ones in chacha20 instead of rand_chacha (#1642).IndexedRandom::choose_multiple -> sample, choose_multiple_array -> sample_array, choose_multiple_weighted -> sample_weighted, struct SliceChooseIter -> IndexedSamples and fns IteratorRandom::choose_multiple -> sample, choose_multiple_fill -> sample_fill (#1632)Fill be implemented for element types, not sliceable types (#1652)OsError::raw_os_error on UEFI targets by returning Option<usize> (#1665)TryRngCore::read_adapter(..) -> RngReadAdapter with simpler struct RngReader (#1669)SeedableRng::from_os_rng, try_from_os_rng (#1674)Clone support for StdRng, ReseedingRng (#1677)postcard instead of bincode to test the serde feature (#1693)IteratorRandom::sample when amount is much larger than iterator size (#1695)os_rng -> sys_rng, OsRng -> SysRng, OsError -> SysError (#1697)Rng -> RngExt as upstream rand_core has renamed RngCore -> Rng (#1717)IndexedRandom::choose_iter, choose_weighted_iter (#1632)Xoshiro128PlusPlus, Xoshiro256PlusPlus prngs (#1649)ChaCha8Rng, ChaCha12Rng, ChaCha20Rng behind chacha feature (#1659)rand::make_rng() -> R where R: SeedableRng (#1734)ReseedingRng (#1722)small_rng (#1732)Full Changelog: 0.9.2...0.10.0
This release makes a number of significant changes which we hope will be the last significant breakage before 1.0. Code has moved from the rust-random/rand repository to its own rust-random/rand_core.
RngCore and TryRngCore are renamed to Rng and TryRng respectively (#54)Rng is now an extension trait of TryRng<Error = Infallible> (#45)TryRng::Error is bound on core::error::Error instead of Debug + Display (#58)Sized bound on impls of SeedableRng (rand#1641)TryRng::read_adapter method (replaced with rand::RngReader) (rand#1669)os_rng crate feature (rand#1674)OsRng and OsError structs (rand#1674)SeedableRng::from_os_rng and SeedableRng::try_from_os_rng methods (rand#1674)getrandom dependency (rand#1674)std crate feature (rand#1674)serde dependency (#28)UnwrapMut struct and Rng::unwrap_mut method (#45)Rng::unwrap_err method in favor of explicit wrapping in UnwrapErr (#53)BlockRng::reconstruct and BlockRng::remaining_results methods (#36)block::Generator::drop method (#35)BlockRng::word_offset method (#44)le helper functions with new utils helpers (rand#1667, #34, #38, #45)BlockRng::generate_and_set method to reset_and_skip (#44)block::BlockRngCore trait to block::Generator (#26)BlockRngCore::Results associated type to Output and remove type bounds on it (#26)Rng for BlockRng, making the latter more generic (#34)BlockRng64 struct (#34)BlockRng::reset method (#44)BlockRng::index method (replaced with BlockRng::word_offset) (#44)Generator::Item associated type (#26)CryptoBlockRng (#69)Full Changelog: v0.9.3...v0.10.0
rand_chacha has been replaced with a dependency on chacha20. This changes the implementation behind StdRng, but the output remains the same. There may be some API breakage when using the ChaCha-types directly as these are now the ones in chacha20 instead of rand_chacha (#1642).IndexedRandom::choose_multiple -> sample, choose_multiple_array -> sample_array, choose_multiple_weighted -> sample_weighted, struct SliceChooseIter -> IndexedSamples and fns IteratorRandom::choose_multiple -> sample, choose_multiple_fill -> sample_fill (#1632)Fill be implemented for element types, not sliceable types (#1652)OsError::raw_os_error on UEFI targets by returning Option<usize> (#1665)TryRngCore::read_adapter(..) -> RngReadAdapter with simpler struct RngReader (#1669)SeedableRng::from_os_rng, try_from_os_rng (#1674)Clone support for StdRng, ReseedingRng (#1677)postcard instead of bincode to test the serde feature (#1693)IteratorRandom::sample when amount is much larger than iterator size (#1695)os_rng -> sys_rng, OsRng -> SysRng, OsError -> SysError (#1697)Rng -> RngExt as upstream rand_core has renamed RngCore -> Rng (#1717)IndexedRandom::choose_iter, choose_weighted_iter (#1632)Xoshiro128PlusPlus, Xoshiro256PlusPlus prngs (#1649)ChaCha8Rng, ChaCha12Rng, ChaCha20Rng behind chacha feature (#1659)rand::make_rng() -> R where R: SeedableRng (#1734)Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
rand v0.9.5: backport #1790 by @dhardy in #1803
Fixes Fix doc build ( #1766 ) Full Changelog : 0.9.3...0.9.4
This release back-ports a fix from v0.10. See also [ #1763 ].
Deprecate rand::mock module and StepRng generator ([#1634])
rand::rngs::mock module and StepRng generator ([#1634])WeightedIndex<usize> (de)serialization ([#1646])Revise "not a crypto library" policy again ([#1565])
simd_support for recent nightly rust (#1586)fn rand::seq::index::sample_weighted and fn IndexedRandom::choose_multiple_weighted to return fewer than amount results (#1623), reverting an undocumented change ([#1382]) to the previous release.Policy: "rand is not a crypto library" ([#1514])
ReseedingRng and ThreadRng. Instead, it is recommended to call ThreadRng::reseed on fork. (#1379)zerocopy to replace some unsafe code (#1349, #1393, #1446, #1502)--ignore-rust-versionrand_core v0.9.0 (#1558)std feature without getrandom or rand_chacha (#1354)small_rng by default (#1455)rand_chacha; use std_rng instead. (#1473)serde1 to serde (#1477)getrandom to os_rng (#1537)thread_rng (#1547)RngCore::read_adapter implementing std::io::Read (#1267)CryptoBlockRng: BlockRngCore; make trait CryptoRng: RngCore (#1273)TryRngCore, TryCryptoRng (#1424, #1499)fn SeedableRng::from_rng -> try_from_rng and add infallible variant fn from_rng (#1424)fn SeedableRng::from_entropy -> from_os_rng and add fallible variant fn try_from_os_rng (#1424)Clone and AsRef to associated type SeedableRng::Seed (#1491)rand::thread_rng() to rand::rng() and remove from the prelude (#1506)rand::random() from the prelude (#1506)random_iter, random_range, random_bool, random_ratio, fill (#1488)Rng::gen_iter as random_iter (#1305, #1500)Rng::gen to random to avoid conflict with the new gen keyword in Rust 2024 (#1438)Rng::gen_range to random_range, gen_bool to random_bool, gen_ratio to random_ratio (#1505)#[track_caller] (#1442, #1447)<SmallRng as SeedableRng>::Seed size to 256 bits (#1455)rng) of ReseedingRng::new (#1533)SliceRandom into IndexedRandom, IndexedMutRandom, SliceRandom (#1382)IndexedRandom::choose_multiple_array, index::sample_array (#1453, #1469)rand::distributions to rand::distr (#1470)Standard to StandardUniform (#1526)distr::Slice -> distr::slice::Choose, distr::EmptySlice -> distr::slice::Empty (#1548)distr::DistString -> distr::SampleString (#1548)distr::DistIter -> distr::Iter, distr::DistMap -> distr::Map (#1548)Sized bound on Distribution<T> for &D (#1278)Distribution<Option<T>> for StandardUniform (#1526)StandardUniform support all NonZero* types (#1332){Uniform, UniformSampler}::{new, new_inclusive} return a Result (instead of potentially panicking) (#1229)Uniform implements TryFrom instead of From for ranges (#1229)UniformUsize (#1487)isize and usize values with StandardUniform, Uniform (except via UniformUsize) and Fill and usage as a WeightedAliasIndex weight (#1487)DistString for distributions Slice<char> and Uniform<char> (#1315)Slice::num_choices (#1402)p() for distribution Bernoulli to access probability (#1481)pub module rand::distr::weighted, moving WeightedIndex there (#1548)weighted::Weight, allowing WeightedIndex to trap overflow (#1353)weight, weights, total_weight to distribution WeightedIndex (#1420)WeightedError to weighted::Error, revising variants (#1382) and mark as #[non_exhaustive] (#1480)std::simd, expand SIMD & docs (#1239)ReseedingRng::reseed discard remaining data from the last block generated (#1379)SmallRng::seed_from_u64 implementation (#1203)UniformFloat::new samples and UniformFloat::sample_single to yield high (#1462)Slice (#1469)Uniform for usize portable via UniformUsize (#1487)IndexdRandom::choose_multiple_weighted for very small seeds and optimize for large input length / low memory (#1530)sample_floyd, affecting output of rand::seq::index::sample and rand::seq::SliceRandom::choose_multiple (#1277)IteratorRandom::choose and choose_stable (#1268)SliceRandom::shuffle and partial_shuffle (#1272)Uniform: use Canon's method (single sampling) / Lemire's method (distribution sampling) for faster sampling (breaks value stability; #1287)sample_single_inclusive for floats (+~20% perf) (#1289)Cargo.lock.msrv file (#1275)rustfmt and enforce (#1448)benches crate (#1329, #1439) and migrate to Criterion (#1490)Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Move wasm-bindgen shims to correct crate ([#686])
wasm32-unknown-unknown compile but fail at run-time if missing bindings ([#686])Make the std feature require the optional rand_os dependency ([#675])
std feature require the optional rand_os dependency ([#675])rand_os from rand to avoid breakage ([#674])Add Default for ThreadRng ([#657])
Default for ThreadRng ([#657])rngs::OsRng to rand_os sub-crate; clean up code; use as dependency ([#643])rand_xoshiro sub-crate, plus benchmarks ([#642], [#668])UniformInt::sample_single ([#662])autocfg instead of rustc_version for rustc version detection ([#664])i128 and u128 if the target_os is emscripten ([#671]: work-around Emscripten limitation)UnitCircle and UnitSphereSurface distributions (no PR)Support sampling Duration also for no_std (only since Rust 1.25) ([#649])
Duration also for no_std (only since Rust 1.25) ([#649])libc ([#647])Remove functionality already deprecated in 0.5 ([#499])
OsRng for powerpc64, sparc and sparc64 (#609)syscall from libc on Linux instead of redefining it (#629)SmallRng to use PCG (#623)Pcg32 and Pcg64Mcg generators (#632)Rc from ThreadRng (#615)Rng.gen_ratio() and Bernoulli::new_ratio() (#491)Uniform strictly respect f32 / f64 high/low bounds (#477)gen_range and Uniform to work on non-Copy types (#506)Uniform supports inclusive ranges: Uniform::from(a..=b). This is automatically enabled for Rust >= 1.27. (#566)TrustedLen and FusedIterator for DistIter (#620)Dirichlet distribution (#485)Bernoulli::new (#500)char sampling (#519)std::time::Duration (#583)seq module (#483, #515)WeightedIndex and choose_weighted (#518, #547)sample_indices function (#479)Iterator::size_hint() to speed up IteratorRandom::choose (#593)i128 and u128 is automatically enabled for Rust >= 1.26. This renders the i128_support feature obsolete. It still exists for backwards compatibility but does not have any effect. This breaks programs using Rand with i128_support on nightlies older than Rust 1.26. (#571)Added Cauchy distribution. ([#474], [#486])
OsRng/dev/random. ([#484])getentropy like OpenBSD. ([#484])getrandom if available, otherwise /dev/random. ([#484])stdweb: split the read up in chunks. ([#484])/dev/random. ([#484])fill_bytes. ([#484])Deprecate rand_derive. ([#256])
rand_core crate. (#288)rand_derive. (#256)prelude (and module reorganisation). (#435)log feature. Logging is now available in JitterRng, OsRng, EntropyRng and ReseedingRng. (#246)serde1 feature for some PRNGs. (#189)stdweb feature for OsRng support on WASM via stdweb. (#272, #336)Rng traitRng into RngCore and Rng extension trait. next_u32, next_u64 and fill_bytes are now part of RngCore. (#265)Rng::sample. (#256)Rng::gen_weighted_bool. (#308)Rng::gen_bool. (#308)Rng::next_f32 and Rng::next_f64. (#273)Rng::fill and Rng::try_fill methods. (#247)Rng::gen_iter. (#286)Rng::gen_ascii_chars. (#279)rand_core craterand now depends on new rand_core crate (#288)RngCore and SeedableRng are now part of rand_core. (#288)impl and le. (#209, #228)Error and ErrorKind. (#225)CryptoRng marker trait. (#273)BlockRngCore trait. (#281)BlockRng and BlockRng64 wrappers to help implementations. (#281, #325)SeedableRng trait. (#233)RngCore::next_u64 and RngCore::fill_bytes. (#288)RngCore::try_fill_bytes. (#225)FromEntropy trait. (#233, #375)SmallRng wrapper. (#296)ReseedingRng to only work with BlockRngCore (substantial performance improvement). (#281)weak_rng. Use SmallRng instead. (#296)AsciiGenerator. (#279)StdRng and thread_rng to HC-128. (#277)StdRng must now be created with from_entropy instead of newthread_rng reseeding threshold to 32 MiB. (#277)Copy. (#209)Debug implementations no longer show internals. (#209)Clone for ReseedingRng, JitterRng, OsRng`. (#383, #384)XorShiftRng, IsaacRng and Isaac64Rng under the serde1 feature. (#189)BlockRngCore for ChaChaCore and Hc128Core. (#281)Isaac64Rng::next_u32 no longer throws away half the results. (#209)IsaacRng::new_from_u64 and Isaac64Rng::new_from_u64. (#209)Hc128Rng. (#210)JitterRng to get its size down from 2112 to 24 bytes. (#251)OsRngOsRng via stdweb, behind the stdweb feature. (#272, #336)getrandom on more platforms for Linux, and on Android. (#338)SecRandomCopyBytes interface on macOS. (#322)OsRng. (#239)/dev/random, then /dev/urandom. (#338)OsRng (using new error type). (#225)OsRng now uses non-blocking when available. (#225)EntropyRng, which provides OsRng, but has JitterRng as a fallback. (#235)Distribution trait. (#256)Distribution::sample_iter and Rng::::sample_iter. (#361)Rand, Sample and IndependentSample traits. (#256)Standard distribution (replaces most Rand implementations). (#256)Binomial and Poisson distributions. (#96)Bernoulli dsitribution. (#411)Alphanumeric distribution. (#279)Closed01 distribution, add OpenClosed01. (#274, #420)Range type, making it possible to implement it for user types. (#274)Range to Uniform. (#395)Uniform::new_inclusive for inclusive ranges. (#274)Standard distribution for char uses Uniform internally. (#274)Standard distribution for bool uses sign test. (#274)Standard distribution for Wrapping<T>. (#436)Uniform distribution for Duration. (#427)Use correct syscall number for PowerPC ([#589])
### Changed - Use winapi on Windows - Update for Fuchsia OS - Remove dev-dependency on log
winapi on Windowslog### Added - no_std support
no_std supportDisable the std feature by default ([rand#702])
std feature by default (rand#702)Nothing published for this version
### Fixed - Fix compile on Windows
Update to use log version 0.3.x
Nothing published for this version
Nothing published for this version
### Fixed - Compatible with Rust master - Fixed iOS compilation
Compatible with Rust master (move from old_io to std::io)
old_io to std::io)Nothing published for this version
Migrate to a cargo-compatible directory structure.
gen_weighted_bool(1)(Split out of the Rand crate, changes here are relative to rand 0.4.2.)
(Split out of the Rand crate, changes here are relative to rand 0.4.2.)
RngCore and SeedableRng are now part of rand_core. (rand#288)impl and le. (rand#209, rand#228)Error and ErrorKind. (rand#225)CryptoRng marker trait. (rand#273)BlockRngCore trait. (rand#281)BlockRng and BlockRng64 wrappers to help implementations. (rand#281, rand#325)RngCore::try_fill_bytes. (rand#225)Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →