Skip to main content

hoomd_rand/
lib.rs

1// Copyright (c) 2024-2026 The Regents of the University of Michigan.
2// Part of hoomd-rs, released under the BSD 3-Clause License.
3
4//! Provides a collection of fast, high-quality random number generators (RNGs) for the HOOMD ecosystem.
5//!
6//! This crate offers implementations of several modern RNG algorithms, including:
7//!
8//! - [`SFC64`]: The "Small Fast Chaotic" counter based RNG, which should used by default
9//!   in most cases. It is extremely fast, has low latency, and is very
10//!   statistically sound -- we have validated that streams are independent and
11//!   uncorrelated for >2TB of data per seed.
12//! - `AESRand`: An AES-based RNG (currently only available on some aarch64
13//!   platforms). This can be even faster than SFC64, but has a smaller state that
14//!   makes it less suitable for highly parallel applications.
15//!
16//! # Complete documentation
17//!
18//! `hoomd-rand` is is a part of *hoomd-rs*. Read the [complete documentation]
19//! for more information.
20//!
21//! [complete documentation]: https://hoomd-rs.readthedocs.io
22
23/// Utility functions for random number generation.
24pub(crate) mod util;
25
26#[cfg(feature = "extras")]
27mod threefry2x64;
28#[cfg(feature = "extras")]
29pub use threefry2x64::ThreeFry2x64Rng;
30
31/// Structs and implementations for the SFC64 PRNG.
32mod sfc;
33pub use sfc::SFC64;
34
35mod counter;
36pub use counter::Counter;
37
38#[cfg(all(
39    target_arch = "aarch64",
40    target_feature = "neon",
41    target_feature = "aes"
42))]
43mod aesrand;
44#[cfg(all(
45    target_arch = "aarch64",
46    target_feature = "neon",
47    target_feature = "aes"
48))]
49pub use aesrand::AESRand;