Cargo Features

getrandom has no features set by default.

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

Implement std-only traits for getrandom::Error

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

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.

compiler_builtins rustc-dep-of-std?

With default (compiler-builtins)

core rustc-dep-of-std?

Enables rustc-std-workspace-core

js-sys cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown")) js?
wasm-bindgen cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown")) js?