mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-01 18:14:25 +00:00
Polish the chapter of array and linkedlist
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
const std = @import("std");
|
||||
const inc = @import("include");
|
||||
|
||||
// 随机返回一个数组元素
|
||||
// 随机访问元素
|
||||
pub fn randomAccess(nums: []i32) i32 {
|
||||
// 在区间 [0, nums.len) 中随机抽取一个整数
|
||||
var randomIndex = std.crypto.random.intRangeLessThan(usize, 0, nums.len);
|
||||
|
||||
Reference in New Issue
Block a user