|
5 | 5 | http::{header::HeaderName, request, HeaderValue}, |
6 | 6 | once_cell::sync::{Lazy, OnceCell}, |
7 | 7 | quickjs_wasm_rs::{Context, Deserializer, Exception, Serializer, Value}, |
8 | | - rand::{thread_rng, Rng}, |
| 8 | + rand::{rngs::OsRng, Rng}, |
9 | 9 | send_wrapper::SendWrapper, |
10 | 10 | serde::{Deserialize, Serialize}, |
11 | 11 | serde_bytes::ByteBuf, |
@@ -265,7 +265,7 @@ fn get_glob(context: &Context, _this: &Value, args: &[Value]) -> Result<Value> { |
265 | 265 | } |
266 | 266 |
|
267 | 267 | fn get_rand(context: &Context, _this: &Value, _args: &[Value]) -> Result<Value> { |
268 | | - context.value_from_u32(thread_rng().gen_range(0..=255)) |
| 268 | + context.value_from_u32(OsRng.gen_range(0..=255)) |
269 | 269 | } |
270 | 270 |
|
271 | 271 | fn get_hash(context: &Context, _this: &Value, args: &[Value]) -> Result<Value> { |
@@ -333,7 +333,7 @@ fn get_hmac(context: &Context, _this: &Value, args: &[Value]) -> Result<Value> { |
333 | 333 | } |
334 | 334 |
|
335 | 335 | fn math_rand(context: &Context, _this: &Value, _args: &[Value]) -> Result<Value> { |
336 | | - context.value_from_f64(thread_rng().gen_range(0.0_f64..1.0)) |
| 336 | + context.value_from_f64(OsRng.gen_range(0.0_f64..1.0)) |
337 | 337 | } |
338 | 338 |
|
339 | 339 | fn redis_exec(context: &Context, _this: &Value, args: &[Value]) -> Result<Value> { |
|
0 commit comments