mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-16 07:28:52 +00:00
Set the range of the random number
This commit is contained in:
@@ -103,8 +103,7 @@ pub fn test_irgen(path: &Path) {
|
|||||||
.translate(&unit)
|
.translate(&unit)
|
||||||
.unwrap_or_else(|irgen_error| panic!("{}", irgen_error));
|
.unwrap_or_else(|irgen_error| panic!("{}", irgen_error));
|
||||||
|
|
||||||
// Apply random value to global variable `dyn`
|
let rand_num = rand::thread_rng().gen_range(1, 100);
|
||||||
let rand_num = rand::thread_rng().gen();
|
|
||||||
let new_c = modify_c(path, rand_num);
|
let new_c = modify_c(path, rand_num);
|
||||||
modify_ir(&mut ir, rand_num);
|
modify_ir(&mut ir, rand_num);
|
||||||
|
|
||||||
@@ -300,8 +299,7 @@ pub fn test_asmgen(path: &Path) {
|
|||||||
.translate(&ir)
|
.translate(&ir)
|
||||||
.expect("fail to create riscv assembly code");
|
.expect("fail to create riscv assembly code");
|
||||||
|
|
||||||
// Resolve examples
|
let rand_num = rand::thread_rng().gen_range(1, 100);
|
||||||
let rand_num = rand::thread_rng().gen();
|
|
||||||
modify_ir(&mut ir, rand_num);
|
modify_ir(&mut ir, rand_num);
|
||||||
modify_asm(&mut asm, rand_num);
|
modify_asm(&mut asm, rand_num);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user