Merge pull request #259 from ftabaro/master

add simple rust example :D
This commit is contained in:
Luke Oliff
2018-10-08 10:02:54 -07:00
committed by GitHub
3 changed files with 39 additions and 0 deletions

7
code/ftabaro/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "ftabaro"
version = "0.1.0"
authors = ["ftabaro <francesco.tabaro@gmail.com>"]
[dependencies]
rand = "0.5.5"

26
code/ftabaro/src/main.rs Normal file
View File

@@ -0,0 +1,26 @@
extern crate rand;
use rand::prelude::*;
fn main() {
let mut obv = 0;
let mut rev = 0;
let mut i = 0;
while i < 10 {
if random() {
obv += 1;
} else {
rev += 1;
}
i += 1;
}
if obv > rev {
println!("Obverse wins!")
} else {
println!("Reverse wins!")
}
println!("Get info about coin history at https://en.wikipedia.org/wiki/Obverse_and_reverse")
}