Skip to content

Commit

Permalink
Fixes data_type.gen
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoximenes committed Jan 10, 2025
1 parent 8d25910 commit 94f9ea1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arbitrator/tools/stylus_benchmark/src/scenarios/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ impl Rand for DataType {
fn gen(&self) -> usize {
let mut rng = rand::thread_rng();
match self {
DataType::I32 => (rng.gen::<u32>() >> 1).try_into().unwrap(),
DataType::I64 => (rng.gen::<u64>() >> 1).try_into().unwrap(),
// makes sure that the generated number fits a signed integer
DataType::I32 => (rng.gen::<u32>() >> 1 - 1).try_into().unwrap(),
DataType::I64 => (rng.gen::<u64>() >> 1 - 1).try_into().unwrap(),
}
}
}

0 comments on commit 94f9ea1

Please sign in to comment.