(_state: &mut State<'gc>, args: Vec<Value<'gc>>)
| 43 | } |
| 44 | |
| 45 | fn random_seed<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
| 46 | let seed = if args.is_empty() { |
| 47 | // Use current time as seed if none provided |
| 48 | SystemTime::now() |
| 49 | .duration_since(SystemTime::UNIX_EPOCH) |
| 50 | .unwrap() |
| 51 | .as_secs() |
| 52 | } else { |
| 53 | float_arg!(&args, 0, "seed")? as u64 |
| 54 | }; |
| 55 | |
| 56 | RNG.with(|rng| { |
| 57 | *rng.borrow_mut() = StdRng::seed_from_u64(seed); |
| 58 | }); |
| 59 | |
| 60 | Ok(Value::Number(seed as f64)) |
| 61 | } |
| 62 | |
| 63 | fn random_float<'gc>( |
| 64 | _state: &mut State<'gc>, |
nothing calls this directly
no test coverage detected