Generate boxes.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-06-30 17:59:19 +02:00
parent a3fd53f658
commit 3affea8701

View File

@ -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);
}
}
}