mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-07 13:14:19 +00:00
Polish the chapter of array and linkedlist
This commit is contained in:
@@ -8,7 +8,7 @@ include!("../include/include.rs");
|
||||
|
||||
use rand::Rng;
|
||||
|
||||
/* 随机返回一个数组元素 */
|
||||
/* 随机访问元素 */
|
||||
fn random_access(nums: &[i32]) -> i32 {
|
||||
// 在区间 [0, nums.len()) 中随机抽取一个数字
|
||||
let random_index = rand::thread_rng().gen_range(0..nums.len());
|
||||
|
||||
Reference in New Issue
Block a user