* fixed _unix_random bug * add custom instruction "random" * update to spec 1.12 * more cli options
7 lines
202 B
Rust
7 lines
202 B
Rust
use fastrand;
|
|
use crate::RunError;
|
|
|
|
pub fn random(memory: &mut Vec<u16>) {
|
|
let data = &memory.pop().expect(&format!("{}", RunError::MemoryEmpty));
|
|
memory.push(fastrand::u16(..) % (*data - 1));
|
|
} |