Generate boxes.
This commit is contained in:
parent
a3fd53f658
commit
3affea8701
16
src/main.rs
16
src/main.rs
@ -22,6 +22,20 @@
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
extern crate rand;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let size = 100;
|
||||
let mut boxes:Vec<u32> = Vec::with_capacity(size as usize);
|
||||
|
||||
{
|
||||
let mut nums:Vec<u32> = (1..size+1).collect();
|
||||
|
||||
for _i in 0..nums.len()
|
||||
{
|
||||
let rand_i:usize = rand::random::<usize>() % nums.len();
|
||||
boxes.push(nums[rand_i]);
|
||||
nums.remove(rand_i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user