mirror of https://github.com/smol-rs/fastrand
Compare commits
3 Commits
3125e8b95c
...
6d10ce096e
Author | SHA1 | Date |
---|---|---|
ironhaven | 6d10ce096e | |
Felipe Manzano | dda0fe824b | |
ironhaven | a5e5406ca7 |
|
@ -193,8 +193,7 @@ fn random_seed() -> Option<u64> {
|
|||
let mut hasher = DefaultHasher::new();
|
||||
Instant::now().hash(&mut hasher);
|
||||
thread::current().id().hash(&mut hasher);
|
||||
let hash = hasher.finish();
|
||||
Some((hash << 1) | 1)
|
||||
Some(hasher.finish())
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
|
|
|
@ -286,10 +286,7 @@ impl Rng {
|
|||
#[inline]
|
||||
#[must_use = "this creates a new instance of `Rng`; if you want to initialize the thread-local generator, use `fastrand::seed()` instead"]
|
||||
pub fn with_seed(seed: u64) -> Self {
|
||||
let mut rng = Rng(0);
|
||||
|
||||
rng.seed(seed);
|
||||
rng
|
||||
Rng(seed)
|
||||
}
|
||||
|
||||
/// Clones the generator by deterministically deriving a new generator based on the initial
|
||||
|
|
Loading…
Reference in New Issue