Use Rng instances for better performance
masterInstead of using the global thread-local generator, you can instantiate a local Rng instance. This is more efficient for high-performance requirements, such as generating large amounts of data in a loop.
use std::iter::repeat_with;
// Create a new Rng instance
let mut rng = fastrand::Rng::new();
// Use the instance to generate data efficiently
let mut bytes: Vec<u8> = repeat_with(|| rng.u8(..)).take(10_000).collect();