Stephen Seo
9e9bb0758c
"rand" crate was not compilable for wasm-unknown-unknown target, so an alternative "oorandom" crate was substituted in. Basic game win/draw detection logic added.
13 lines
296 B
Rust
13 lines
296 B
Rust
use oorandom::Rand32;
|
|
|
|
use std::time::{SystemTime, UNIX_EPOCH};
|
|
|
|
pub fn get_seeded_random() -> Result<Rand32, String> {
|
|
let now = SystemTime::now();
|
|
let duration = now
|
|
.duration_since(UNIX_EPOCH)
|
|
.map_err(|e| format!("{}", e))?;
|
|
|
|
Ok(Rand32::new(duration.as_secs()))
|
|
}
|