Refactor random number generation to factory
- Use a `make-random` factory to create isolated random number generators. - Remove the global `prng` from the `Environment`. - Ensure `make-random` can be called with or without a seed.
This commit is contained in:
@@ -28,7 +28,6 @@ pub struct Environment {
|
||||
pub global_types: Rc<RefCell<HashMap<GlobalIdx, StaticType>>>,
|
||||
pub global_purity: Rc<RefCell<HashMap<GlobalIdx, Purity>>>,
|
||||
pub global_values: Rc<RefCell<Vec<Value>>>,
|
||||
pub prng: Rc<RefCell<fastrand::Rng>>,
|
||||
pub function_registry: Rc<RefCell<HashMap<GlobalIdx, BoundNode>>>,
|
||||
pub typed_function_registry: Rc<RefCell<HashMap<GlobalIdx, AnalyzedNode>>>,
|
||||
pub monomorph_cache: Rc<RefCell<MonoCache>>,
|
||||
@@ -102,7 +101,6 @@ impl Environment {
|
||||
global_types: Rc::new(RefCell::new(HashMap::new())),
|
||||
global_purity: Rc::new(RefCell::new(HashMap::new())),
|
||||
global_values: Rc::new(RefCell::new(Vec::new())),
|
||||
prng: Rc::new(RefCell::new(fastrand::Rng::new())),
|
||||
function_registry: Rc::new(RefCell::new(HashMap::new())),
|
||||
typed_function_registry: Rc::new(RefCell::new(HashMap::new())),
|
||||
monomorph_cache: Rc::new(RefCell::new(HashMap::new())),
|
||||
|
||||
Reference in New Issue
Block a user