Cargo Features

[dependencies]
rand = { version = "0.8.5", default-features = false, features = ["nightly", "serde1", "std", "alloc", "getrandom", "simd_support", "std_rng", "small_rng", "min_const_gen", "log"] }
default = std, std_rng

Meta-features:

nightly

enables performance optimizations requiring nightly rust

serde1 = serde

Enables serde1 of rand_core

std default = alloc, getrandom, libc

Option (enabled by default): without "std" rand uses libcore; this option enables functionality expected to be available on a standard platform.

Enables std of rand_chacha and rand_core

Affects rngs::adapter, index::sample_weighted, seq::SliceRandom.choose_multiple_weighted, rand::random

alloc std

Option: "alloc" enables support for Vec and Box when not using "std"

Enables alloc of rand_core

Affects distribution::DistString, distributions::weighted, seq::index, seq::SliceRandom.choose_multiple, seq::SliceRandom.choose_weighted, seq::SliceRandom.choose_weighted_mut, seq::IteratorRandom.choose_multiple, seq::SliceChooseIter

getrandom std

Option: use getrandom package for seeding

Enables getrandom of rand_core

simd_support = packed_simd

Option (requires nightly): experimental SIMD support

std_rng default = rand_chacha

Option (enabled by default): enable StdRng

Affects rand::random

small_rng

Option: enable SmallRng

min_const_gen

Option: for rustc ≥ 1.51, enable generating random arrays of any size using min-const-generics

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features.

log implicit feature
serde serde1?

With derive and default (std)

rand_chacha std_rng
libc cfg(unix) std
packed_simd simd_support?

Enables into_bits of packed_simd_2