Cargo Features

getrandom has no features set by default.

[dependencies]
getrandom = { version = "0.2.14", features = ["std", "linux_disable_fallback", "rdrand", "js", "custom", "rustc-dep-of-std", "test-in-browser"] }
std

Implement std-only traits for getrandom::Error

linux_disable_fallback

Disable /dev/urandom fallback for Linux and Android targets. Bumps minimum supported Linux kernel version to 3.17 and Android API level to 23 (Marshmallow).

rdrand

Feature to enable fallback RDRAND-based implementation on x86/x86_64

js = js-sys, wasm-bindgen

Feature to enable JavaScript bindings on wasm*-unknown-unknown

custom

Feature to enable custom RNG implementations

rustc-dep-of-std = compiler_builtins, core

Unstable feature to support being a libstd dependency

Enables rustc-dep-of-std of libc and wasi ^0.11

test-in-browser

Unstable/test-only feature to run wasm-bindgen tests in a browser

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

compiler_builtins rustc-dep-of-std?

Enables compiler_builtins

When built as part of libstd

core rustc-dep-of-std?

Enables rustc-std-workspace-core

js-sys wasm32 wasm64 unknown js?
wasm-bindgen wasm32 wasm64 unknown js?