Started TP3
This commit is contained in:
20
Session1/TP3/simon/src/main.rs
Normal file
20
Session1/TP3/simon/src/main.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use rand::prelude::*;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let turns: Vec<i8> = gen_turn_array();
|
||||
for turn in turns {
|
||||
println!("{}", turn);
|
||||
}
|
||||
}
|
||||
|
||||
fn gen_turn_array() -> Vec<i8> {
|
||||
let mut rng = rand::thread_rng();
|
||||
let mut vec = Vec::with_capacity(255);
|
||||
|
||||
for _ in 0..255 {
|
||||
vec.push(rng.gen_range(1..5));
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
Reference in New Issue
Block a user