Started TP3
This commit is contained in:
7
Session1/TP3/simon/Cargo.toml
Normal file
7
Session1/TP3/simon/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "simon"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rand = "0.8.5"
|
||||
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