Crate frand

source ·
Expand description

§Frand

FRand is a blazingly fast, small, and simple pseudo-random number generator (PRNG) written in Rust. The advantage of using FRand is that it can produce more random numbers per second than other libraries. It also produces high-quality random numbers using a fast non-cryptographic hashing algorithm.

§Usage

This crate is available on crates.io and can be used by adding frand to your dependencies in your project’s Cargo.toml.

[dependencies]
frand = "0.10"

FRand is really simple to use. Here is a simple example of how to use FRand to generate a random float:

use frand::Rand;

let mut rng = Rand::new();
println!("{}", rng.gen::<f32>());

§Crate features

  • std - (default) Enables the use of the standard library. This feature is required for the new and rehash functions.
  • impl_rng_core - (default) Enables the implementation of the rand::RngCore and rand::SeedableRng traits for the Rand struct. This feature is required to use FRand with the rand and things like rand::distributions.
  • glam - (default) Uses glam to enable the generation of random values for glam::Vec2, glam::Vec3, glam::Vec3A, and glam::Vec4.

Macros§

Structs§

Traits§

Functions§

  • Retrieve the lazily-initialized thread-local random number generator.