diff --git a/Cargo.toml b/Cargo.toml index ffc5f0d..e18f3e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,9 @@ categories = ["algorithms"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] - +rand = { version = "0.9.0" , optional = true} [features] -default = ["std"] +default = ["std","random"] std = [] no_std = [] +random = ["std","rand"] \ No newline at end of file diff --git a/README.org b/README.org index 8b4ad13..9045bda 100644 --- a/README.org +++ b/README.org @@ -33,3 +33,5 @@ *** utils 工具 - [[./src/utils.rs::41][rotate 旋转数组]] +- [[./src/utils.rs][rand_vec 随机向量生成]] + diff --git a/src/utils.rs b/src/utils.rs index 06fc38b..842b410 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,3 +1,6 @@ +#[cfg(feature = "random")] +use rand::{self, Rng}; + /// test the time of function /// # Examples /// ```