Cargo Features

getrandom has no features set by default.

[dependencies]
getrandom = { version = "0.4.1", features = ["std", "wasm_js", "sys_rng"] }
std

Implement From<getrandom::Error> for std::io::Error and use std to retrieve OS error descriptions

wasm_js

Optional backend: wasm_js

This flag enables the wasm_js backend and uses it by default on wasm32 where the target_os is unknown. The getrandom_backend cfg may override this.

WARNING: We strongly recommend against enabling this feature in libraries (except for tests) since it is known to break non-Web WASM builds and further since the usage of wasm-bindgen causes significant bloat to Cargo.lock (on all targets).

The only exception to this rule: if your crate already unconditionally depends on wasm-bindgen or js-sys on "unknown" WASM targets then it's acceptable to enable this feature unconditionally.

Enables js-sys and wasm-bindgen

sys_rng

Provide SysRng over rand_core

Enables rand_core