From 1c144e1c5aeecb3b831b1311627b6a43d627e42c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ko=C5=82aczkowski?= <pkolaczk@gmail.com>
Date: Wed, 7 Aug 2024 10:24:04 +0200
Subject: [PATCH] Use faster RNG

(cherry picked from commit 750395dd2c653aa963614f275acb711dce1d6de6)
---
 Cargo.toml      | 2 +-
 src/workload.rs | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index cb5aebf..1325330 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,7 +35,7 @@ openssl = "0.10.38"
 parse_duration = "2.1.1"
 pin-project = "1.1"
 plotters = { version = "0.3", default-features = false, features = ["line_series", "svg_backend", "full_palette"]}
-rand = "0.8"
+rand = { version = "0.8", default-features = false, features = ["small_rng", "std"] }
 regex = "1.5"
 rune = "0.13"
 rust-embed = "8"
diff --git a/src/workload.rs b/src/workload.rs
index f83be76..080e9d6 100644
--- a/src/workload.rs
+++ b/src/workload.rs
@@ -7,7 +7,7 @@ use std::time::Instant;
 
 use hdrhistogram::Histogram;
 use rand::distributions::{Distribution, WeightedIndex};
-use rand::rngs::StdRng;
+use rand::rngs::SmallRng;
 use rand::{Rng, SeedableRng};
 use rune::alloc::clone::TryClone;
 use rune::compile::meta::Kind;
@@ -482,7 +482,7 @@ impl Workload {
     /// Returns the cycle number and the end time of the query.
     pub async fn run(&self, cycle: i64) -> Result<(i64, Instant), LatteError> {
         let start_time = Instant::now();
-        let mut rng = StdRng::seed_from_u64(cycle as u64);
+        let mut rng = SmallRng::seed_from_u64(cycle as u64);
         let context = SessionRef::new(&self.context);
         let result = self
             .program