From 94f9ea1984569e80d921dc41dd6d954be8b3e829 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 10 Jan 2025 13:20:08 -0300 Subject: [PATCH] Fixes data_type.gen --- arbitrator/tools/stylus_benchmark/src/scenarios/data_type.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arbitrator/tools/stylus_benchmark/src/scenarios/data_type.rs b/arbitrator/tools/stylus_benchmark/src/scenarios/data_type.rs index 94d52ee20f..a9b1697d8c 100644 --- a/arbitrator/tools/stylus_benchmark/src/scenarios/data_type.rs +++ b/arbitrator/tools/stylus_benchmark/src/scenarios/data_type.rs @@ -19,8 +19,9 @@ impl Rand for DataType { fn gen(&self) -> usize { let mut rng = rand::thread_rng(); match self { - DataType::I32 => (rng.gen::() >> 1).try_into().unwrap(), - DataType::I64 => (rng.gen::() >> 1).try_into().unwrap(), + // makes sure that the generated number fits a signed integer + DataType::I32 => (rng.gen::() >> 1 - 1).try_into().unwrap(), + DataType::I64 => (rng.gen::() >> 1 - 1).try_into().unwrap(), } } }