#array #element #random #pick

pick-one

从数组中随机选择一个元素

2 个稳定版本

使用旧的 Rust 2015

1.0.1 2016年10月1日

#20 in #pick

Download history 24/week @ 2024-03-04 27/week @ 2024-03-11 22/week @ 2024-03-18 29/week @ 2024-03-25 66/week @ 2024-04-01 13/week @ 2024-04-08 21/week @ 2024-04-15 19/week @ 2024-04-22 18/week @ 2024-04-29 18/week @ 2024-05-06 23/week @ 2024-05-13 19/week @ 2024-05-20 19/week @ 2024-05-27 18/week @ 2024-06-03 15/week @ 2024-06-10 13/week @ 2024-06-17

65 每月下载量
5 crates 使用

MIT 许可证

2KB

rust-pick-one

从数组中随机选择一个元素

用法

Cargo.toml

[dependencies]
pick-one = "1.0.1"

在你的 lib.rsmain.rs

extern crate pick_one;

let random_choice = pick_one::pick_one_str(&["doggo"]);

依赖项

~320–550KB