PackageTrack
Sign in Get early access

getrandom

A small cross-platform library for retrieving random data from system source

0.4.3 1.8B downloads/mo #3 most downloaded on crates.io rust-random/getrandom

What this package is like to depend on

Last release 2 months ago

17 Jun 2026

Release timing varies

gaps range from 8 days to 5 months

Nearly every release is documented

notes for 43 of 43 stable releases

2 versions withdrawn

withdrawn after publishing

8 years old

48 releases · first in 2019

8 releases in the last 12 months

see the full history below

Release timeline

48 releases · Jan 2019 to Jun 2026
2020 2021 2022 2023 2024 2025 2026
Release Pre-release Withdrawn

Releases

latest 48
  1. 0.4.3 17 Jun 2026
    Release notes

    Added

    • wasm64-unknown-unknown target support for wasm_js backend #848

    Changed

    • Drop wasip2 and wasip3 dependencies in favor of manual bindings
      #830
    Open source →
    Release notes

    Added

    • wasm64-unknown-unknown target support for wasm_js backend #848

    Changed

    • Drop wasip2 and wasip3 dependencies in favor of manual bindings #830
    Open source →
  2. 0.4.2 03 Mar 2026
    Release notes

    Changed

    • Bump r-efi dependency to v6 #814

    Fixed

    • Read errno only when it is set #810
    • Check the return value of ProcessPrng on Windows #811
    Open source →
    Release notes

    Changed

    • Bump r-efi dependency to v6 #814

    Fixed

    • Read errno only when it is set #810
    • Check the return value of ProcessPrng on Windows #811
    Open source →
  3. 0.4.1 03 Feb 2026
    Release notes

    Fixed

    • Documentation build on docs.rs #801
    Open source →
    Release notes

    Fixed

    • Documentation build on docs.rs #801
    Open source →
  4. 0.4.0 02 Feb 2026
    Release notes

    Prepare v0.4.0 release (#798)

    Open source →
    Release notes

    Added

    • RawOsError type alias #739
    • SysRng behind new feature sys_rng #751
    • WASIp3 support #779
    • extern_impl opt-in backend #786 #794
    • Motor OS support #797

    Changed

    • Use Edition 2024 and MSRV 1.85 #749
    Open source →
  5. 0.4.0-rc.1 24 Jan 2026 pre-release
    Release notes
    • Renames (Try)RngCore => (Try)Rng
    • Replace use of unwrap_err in example with UnwrapErr
    Open source →
  6. 0.4.0-rc.0 27 Dec 2025 pre-release
    Release notes

    Prepare v0.4.0-rc.0 (#769)

    Open source →
  7. 0.3.4 14 Oct 2025
    Release notes

    Forgot this because I'm out of practice.

    Signed-off-by: Joe Richey [email protected]

    Open source →
    Release notes

    Major change to wasm_js backend

    Now, when the wasm_js feature is enabled, the wasm_js backend will be used by default. Users of wasm32-unknown-unknown targeting JavaScript environments like the Web and Node.js will no longer need to specify:

    --cfg getrandom_backend="wasm_js"
    

    in RUSTFLAGS for the crate to compile. They can now simple enable a feature.

    Note: this should not affect non-JS users of the wasm32-unknown-unknown target. Using --cfg getrandom_backend will still override the source of randomness even if the wasm_js feature is enabled. This includes --cfg getrandom_backend=custom and --cfg getrandom_backend=unsupported.

    For more information, see the discussions in #671, #675, and #730.

    Added

    • unsupported opt-in backend #667
    • windows_legacy opt-in backend #724

    Changed

    • Implement Memory Sanitizer unpoisoning more precisely #678
    • Relax MSRV for the linux_raw opt-in backend on ARM targets #688
    • Use getrandom syscall on all RISC-V Linux targets #699
    • Replaced wasi dependency with wasip2 #721
    • Enable wasm_js backend by default if the wasm_js feature is enabled #730

    Removed

    • Unstable rustc-dep-of-std crate feature #694
    Open source →
  8. 0.3.3 09 May 2025
    Release notes

    chore: Release getrandom version 0.3.3

    Open source →
    Release notes

    Changed

    • Doc improvements #632 #634 #635
    • Add crate version to docs.rs links used in compile_error!s #639

    Fixed

    • Error handling in WASI p1 #661
    Open source →
  9. 0.3.2 17 Mar 2025
    Release notes

    Added

    • efi_rng opt-in backend #570
    • linux_raw opt-in backend #572
    • .cargo/config.toml example in the crate-level docs #591
    • getrandom_test_linux_without_fallback configuration flag to test that file fallback is not triggered in the linux_android_with_fallback backend #605
    • Built-in support for *-linux-none targets #618
    • Cygwin support #626

    Changed

    • Update wasi dependency to v0.14 #594
    • Add #[inline] attribute to the inner functions #596
    • Update WASI and Emscripten links in the crate-level docs #597
    • Do not use dlsym on MUSL targets in the linux_android_with_fallback backend #602
    • Remove linux_android.rs and use getrandom.rs instead #603
    • Always use RtlGenRandom on Windows targets when compiling with pre-1.78 Rust #610
    • Internal representation of the Error type #614
    • Remove windows-targets dependency and use raw-dylib directly #627

    Removed

    • Error::INTERNAL_START and Error::CUSTOM_START associated constants #614
    Open source →
  10. 0.3.1 28 Jan 2025
    Release notes

    Fixed

    • Build error on Android #588
    Open source →
  11. 0.3.0 25 Jan 2025
    Release notes

    Breaking Changes

    Changed

    • Bump MSRV to 1.63 #542
    • Rename getrandom and getrandom_uninit functions to fill and fill_uninit respectively #532

    Removed

    • wasm32-wasi target support (use wasm32-wasip1 or wasm32-wasip2 instead) #499
    • linux_disable_fallback, rdrand, js, test-in-browser, and custom crate features in favor of configuration flags #504
    • register_custom_getrandom! macro #504
    • Implementation of From<NonZeroU32> for Error and Error::code method #507
    • Internet Explorer 11 support #554
    • Target-specific associated Error constants #562

    Changed

    • Use ProcessPrng on Windows 10 and up, and use RtlGenRandom on older Windows versions #415
    • Do not use locale-specific strerror_r for retrieving error code descriptions #440
    • Avoid assuming usize is the native word size in the rdrand backend #442
    • Do not read from errno when libc did not indicate error on Solaris #448
    • Switch from libpthread's mutex to futex on Linux and to nanosleep-based wait loop on other targets in the use_file backend #490
    • Do not retry on EAGAIN while polling /dev/random on Linux #522
    • Remove separate codepath for Node.js in the wasm_js backend (bumps minimum supported Node.js version to v19) #557
    • Use js_namespace in the wasm_js backend #559

    Added

    • wasm32-wasip1 and wasm32-wasip2 support #499
    • getrandom_backend configuration flag for selection of opt-in backends #504
    • Error::new_custom method #507
    • rndr opt-in backend #512
    • Automatic MemorySanitizer support #521 #571
    • u32 and u64 functions for generating random values of the respective type #544
    • wasm32v1-none support in the wasm_js backend #560
    • wasm_js crate feature which allows users to enable the wasm_js opt-in backend #574

    Fixed

    • NetBSD fallback code based on KERN_ARND #555
    Open source →
  12. 0.3.0-rc.0 29 Nov 2024 pre-release

    Nothing published for this version

  13. 0.2.17 11 Jan 2026
    Release notes

    Release 0.2.17 (#774)

    Open source →
    Release notes

    Fixed

    • Use doc_cfg instead of doc_auto_cfg (partial backport of #732) #768
    • BCryptGenRandom signature #778
    Open source →
  14. 0.2.16 22 Apr 2025
    Release notes

    0.2.16 - 2025-04-22

    Added

    • Cygwin support (backport of #626) #654
    Open source →
    Release notes

    Added

    • Cygwin support (backport of [#626]) #654
    Open source →
  15. 0.2.15 06 May 2024
    Release notes

    Added

    • Apple visionOS support #410

    Changed

    • Use libc::getrandom on DragonflyBSD, FreeBSD, illumos, and Solaris #411 #416 #417 #420
    • Unify libc::getentropy-based implementations #418
    Open source →
  16. 0.2.14 08 Apr 2024
    Release notes

    Fixed

    • Enable /dev/urandom fallback for MUSL-based Linux targets #408
    Open source →
  17. 0.2.13 06 Apr 2024
    Release notes

    Added

    • linux_disable_fallback crate feature to disable /dev/urandom-based fallback on Linux and Android targets. Enabling this feature bumps minimum supported Linux kernel version to 3.17 and Android API level to 23 (Marshmallow). #396

    Changed

    • Disable /dev/urandom fallback for Linux targets outside of the following target_arches: aarch64, arm, powerpc, powerpc64, s390x, x86, x86_64 #396
    • Do not catch EPERM error code on Android while checking availability of the getrandom syscall #396
    Open source →
  18. 0.2.12 09 Jan 2024
    Release notes

    Fixed

    • Custom backend for targets without atomics #385

    Changed

    • Improve robustness of the Hermit backend and sys_fill_exact #386
    • Raise minimum supported Apple OS versions to macOS 10.12 and iOS 10 #388

    Added

    • Document platform support policy #387
    Open source →
  19. 0.2.11 08 Nov 2023
    Release notes

    Added

    • GNU/Hurd support #370

    Changed

    • Renamed __getrandom_internal to __GETRANDOM_INTERNAL #369
    • Updated link to Hermit docs #374
    Open source →
  20. 0.2.10 06 Jun 2023
    Release notes

    Added

    • Support for PS Vita (armv7-sony-vita-newlibeabihf) #359

    Changed

    • Use getentropy from libc on Emscripten targets #362
    Open source →
  21. 0.2.9 06 Apr 2023
    Release notes

    Added

    • AIX support #282
    • getrandom_uninit function #291
    • wasm64-unknown-unknown support #303
    • tvOS and watchOS support #317
    • QNX/nto support #325
    • Support for getrandom syscall on NetBSD ≥ 10.0 #331
    • RtlGenRandom fallback for non-UWP Windows #337

    Breaking Changes

    • Update MSRV to 1.36 #291

    Fixed

    • Solaris/OpenBSD/Dragonfly build #301

    Changed

    • Update MSRV to 1.36 #291
    • Use getentropy on Emscripten #307
    • Solaris: consistently use /dev/random source #310
    • Move 3ds selection above rdrand/js/custom fallback #312
    • Remove buffer zeroing from Node.js implementation #315
    • Use open instead of open64 #326
    • Remove #cfg from bsd_arandom.rs #332
    • Hermit: use sys_read_entropy syscall #333
    • Eliminate potential panic in sys_fill_exact #334
    • rdrand: Remove checking for 0 and !0 and instead check CPU family and do a self-test #335
    • Move __getrandom_custom definition into a const block #344
    • Switch the custom backend to Rust ABI #347
    Open source →
  22. 0.2.8 20 Oct 2022
    Release notes

    Changed

    Added

    • Added benchmarks to track buffer initialization cost #272

    Fixed

    • Use $crate in register_custom_getrandom! #270

    Documentation

    • Add information about enabling "js" feature #280
    • Fix link to wasm-bindgen #278
    • Document the varied implementations for underlying randomness sources #276
    Open source →
  23. 0.2.7 14 Jun 2022
    Release notes

    Changed

    • Update wasi dependency to 0.11 #253

    Fixed

    • Use AtomicPtr instead of AtomicUsize for Strict Provenance compatibility. #263

    Documentation

    • Add comments explaining use of fallback mechanisms #257 #260
    Open source →
  24. 0.2.6 28 Mar 2022
    Release notes

    Added

    • Nintendo 3DS (armv6k-nintendo-3ds) support #248

    Changed

    • Retry open when interrupted #252
    Open source →
  25. 0.2.5 22 Feb 2022
    Release notes

    Added

    • ESP-IDF targets (*‑espidf) support #245

    Fixed

    • Webpack warning caused by dynamic require #234
    • Error checking on iOS for SecRandomCopyBytes #244
    Open source →
  26. 0.2.4 13 Jan 2022
    Release notes

    Changed

    • Use explicit imports in the js backend #220
    • Use /dev/urandom on Redox instead of rand: #222
    • Use NonZeroU32::new_unchecked to convert wasi error #233

    Added

    • SOLID targets (*-kmc-solid_*) support #235
    • Limited Hermit (x86_64-unknown-hermit) support #236
    Open source →
  27. 0.2.3 20 May 2021
    Release notes

    Changed

    • Replace build.rs with link attributes. #205
    • Add support for getrandom syscall on DragonFly BSD. #210
    • Improve Node.js detection. #215
    Open source →
  28. 0.2.2 19 Jan 2021
    Release notes

    Changed

    • Forward rustc-dep-of-std to dependencies. #198
    • Highlight feature-dependent functionality in documentation using the doc_cfg feature. #200
    Open source →
  29. 0.2.1 04 Jan 2021
    Release notes

    Changed

    • Update cfg-if to v1.0. #166
    • Update wasi to v0.10. #167

    Fixed

    • Multithreaded WASM support. #165

    Removed

    • Windows XP support. #177
    • Direct stdweb support. #178
    • CloudABI support. #184
    Open source →
  30. 0.2.0 10 Sep 2020
    Release notes

    Features for using getrandom on unsupported targets

    The following (off by default) Cargo features have been added:

    • "rdrand" - use the RDRAND instruction on no_std x86/x86_64 targets #133
    • "js" - use JavaScript calls on wasm32-unknown-unknown #149
      • Replaces the stdweb and wasm-bindgen features (which are removed)
    • "custom" - allows a user to specify a custom implementation #109

    Breaking Changes

    • Unsupported targets no longer compile #107
    • Change/Add Error constants #120
    • Only impl std traits when the "std" Cargo feature is specified #106
    • Remove official support for Hermit, L4Re, and UEFI #133
    • Remove optional "log" dependency #131
    • Update minimum supported Linux kernel to 2.6.32 #153
    • Update MSRV to 1.34 #159
    Open source →
  31. 0.1.16 31 Dec 2020
    Release notes

    Changed

    • Update cfg-if to v1.0. #173
    • Implement std::error::Error for the Error type on additional targets. #169

    Fixed

    • Multithreaded WASM support. #171
    Open source →
  32. 0.1.15 10 Sep 2020
    Release notes

    Changed

    • Added support for Internet Explorer 11 #139
    • Fix Webpack require warning with wasm-bindgen #137
    Open source →
  33. 0.1.14 07 Jan 2020
    Release notes

    Changed

    • Remove use of spin-locks in the use_file module. #125
    • Update wasi to v0.9. #126
    • Do not read errno value on DragonFlyBSD to fix compilation failure. #129
    Open source →
  34. 0.1.13 25 Oct 2019
    Release notes

    Added

    • VxWorks targets support. #86

    Changed

    • If zero-length slice is passed to the getrandom function, always return Ok(()) immediately without doing any calls to the underlying operating system. #104
    • Use the kern.arandom sysctl on NetBSD. #115

    Fixed

    • Bump cfg-if minimum version from 0.1.0 to 0.1.2. #112
    • Typos and bad doc links. #117
    Open source →
  35. 0.1.12 06 Sep 2019
    Release notes

    Changed

    • Update wasi dependency from v0.5 to v0.7. #100
    Open source →
  36. 0.1.11 25 Aug 2019
    Release notes

    Fixed

    • Implement std-dependent traits for selected targets even if std feature is disabled. (backward compatibility with v0.1.8) #96
    Open source →
  37. 0.1.10 17 Aug 2019 withdrawn
    Release notes

    Changed

    • Use the dummy implementation on wasm32-unknown-unknown even with the disabled dummy feature. #90

    Fixed

    • Fix CSP error for wasm-bindgen. #92
    Open source →
  38. 0.1.9 14 Aug 2019 withdrawn
    Release notes

    Changed

    • Remove std dependency for opening and reading files. #58
    • Use wasi instead of libc on WASI target. #64
    • By default emit a compile-time error when built for an unsupported target. This behaviour can be disabled by using the dummy feature. #71

    Added

    • Add support for UWP targets. #69
    • Add unstable rustc-dep-of-std feature. #78
    Open source →
  39. 0.1.8 05 Aug 2019
    Release notes

    Changed

    • Explicitly specify types to arguments of 'libc::syscall'. #74
    Open source →
  40. 0.1.7 29 Jul 2019
    Release notes

    Added

    • Support for hermit and l4re. #61
    • Error::raw_os_error method, Error::INTERNAL_START and Error::CUSTOM_START constants. Use libc for retrieving OS error descriptions. #54

    Changed

    • Remove lazy_static dependency and use custom structures for lock-free initialization. #51 #52
    • Try getrandom() first on FreeBSD. #57

    Removed

    • Bitrig support. #56

    Deprecated

    • Error::UNKNOWN, Error::UNAVAILABLE. #54
    Open source →
  41. 0.1.6 30 Jun 2019
    Release notes

    Changed

    • Minor change of RDRAND AMD bug handling. #48
    Open source →
  42. 0.1.5 29 Jun 2019
    Release notes

    Fixed

    • Use shared File instead of shared file descriptor. #44
    • Workaround for RDRAND hardware bug present on some AMD CPUs. #43

    Changed

    • Try getentropy and then fallback to /dev/random on macOS. #38
    Open source →
  43. 0.1.4 28 Jun 2019
    Release notes

    Added

    • Add support for x86_64-unknown-uefi target by using RDRAND with CPUID feature detection. #30

    Fixed

    • Fix long buffer issues on Windows and Linux. #31 #32
    • Check EPERM in addition to ENOSYS on Linux. #37

    Changed

    • Improve efficiency by sharing file descriptor across threads. #13
    • Remove cloudabi, winapi, and fuchsia-cprng dependencies. #40
    • Improve RDRAND implementation. #24
    • Don't block during syscall detection on Linux. #26
    • Increase consistency with libc implementation on FreeBSD. #36
    • Apply rustfmt. #39
    Open source →
  44. 0.1.3 17 May 2019
    Release notes
    • Update for wasm32-unknown-wasi being renamed to wasm32-wasi, and for WASI being categorized as an OS.
    Open source →
  45. 0.1.2 06 Apr 2019
    Release notes
    • Add support for wasm32-unknown-wasi target.
    Open source →
  46. 0.1.1 05 Apr 2019
    Release notes
    • Enable std functionality for CloudABI by default.
    Open source →
  47. 0.1.0 23 Mar 2019
    Release notes

    Publish initial implementation.

    Open source →
  48. 0.0.0 19 Jan 2019
    Release notes

    Publish an empty template library.

    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive