nosapi_blackbox 0.2.0

A library for working with Gameforge's blackbox string
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use rand::rngs::StdRng;
use rand::SeedableRng;
use std::cell::Cell;

thread_local! {
    static RAND_SEED: Cell<u64> = const { Cell::new(0) };
}

pub fn set_seed(seed: u64) {
  RAND_SEED.set(seed)
}

pub fn get_rng() -> StdRng {
  RAND_SEED.with(|seed| StdRng::seed_from_u64(seed.get()))
}