aboutsummaryrefslogtreecommitdiff
path: root/calc
diff options
context:
space:
mode:
Diffstat (limited to 'calc')
-rw-r--r--calc/Cargo.toml4
-rw-r--r--calc/src/lib.rs6
2 files changed, 5 insertions, 5 deletions
diff --git a/calc/Cargo.toml b/calc/Cargo.toml
index fe2ecc3..68103e0 100644
--- a/calc/Cargo.toml
+++ b/calc/Cargo.toml
@@ -7,8 +7,8 @@ edition.workspace = true
[dependencies]
pest = "2.7"
pest_derive = "2.7"
-thiserror = "1.0"
-statrs = "0.16"
+thiserror = "2.0"
+statrs = "0.18"
lazy_static.workspace = true
rand.workspace = true
diff --git a/calc/src/lib.rs b/calc/src/lib.rs
index ac8343e..550bbbb 100644
--- a/calc/src/lib.rs
+++ b/calc/src/lib.rs
@@ -1,10 +1,10 @@
use pest::{
+ Parser,
iterators::{
Pair,
Pairs,
},
pratt_parser::PrattParser,
- Parser,
};
use rand::Rng as _;
@@ -153,9 +153,9 @@ fn eval_expr(p: Pairs<Rule>) -> Result<f64, Error> {
let dice_count = lhs as usize;
let dice_faces = rhs as usize;
- let mut rng = rand::thread_rng();
+ let mut rng = rand::rng();
(0..dice_count)
- .map(|_| rng.gen_range(1..(dice_faces + 1)))
+ .map(|_| rng.random_range(1..(dice_faces + 1)))
.sum::<usize>() as f64
}
_ => unreachable!(),