mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-12-22 05:12:40 +00:00
add simple rust example :D
This commit is contained in:
parent
4da95e9a22
commit
1f51efd295
@ -349,6 +349,12 @@ Please note that this project is released with a [Code of Conduct](CODE_OF_CONDU
|
||||
- I share as I learn at [DIY DS](https://www.instagram.com/dodsyourself/) and [DIY CS](https://www.instagram.com/docsyourself/) on instagram.
|
||||
- Started from the bottom, now we here: [![github-alt][github-img]](https://github.com/festusdrakon)
|
||||
|
||||
### Francesco Tabaro
|
||||
- Bioinformatics PhD student
|
||||
- Interested in data science, web development and cooking
|
||||
- [![twitter-alt][twitter-img]](https://twitter.com/FrancescoTabaro)
|
||||
[![github-alt][github-img]](https://github.com/ftabaro)
|
||||
|
||||
### Francisco Nievas (frannievas)
|
||||
- Computer science student
|
||||
- Nerd, geek, gamer, I love TLoK
|
||||
|
7
code/ftabaro/Cargo.toml
Normal file
7
code/ftabaro/Cargo.toml
Normal 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
26
code/ftabaro/src/main.rs
Normal 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")
|
||||
}
|
Loading…
Reference in New Issue
Block a user