Skip to main content

random

Function random 

Source
pub fn random(seed: impl Into<RandomSeed>) -> f64
Expand description

Deterministic pseudo-random number generator matching Remotion’s random(seed).

  • For string seeds: mulberry32(hashCode(seed))
  • For numeric seeds: mulberry32(seed * 10_000_000_000)

§Example

use rust_motion_animation::random;

let r1 = random("seed-1");
let r2 = random("seed-1");
assert_eq!(r1, r2);
assert!(r1 >= 0.0 && r1 < 1.0);