diff --git a/Cargo.lock b/Cargo.lock index e62854d..ca92199 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -296,6 +296,17 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi", +] + [[package]] name = "gfx" version = "0.18.3" @@ -960,6 +971,15 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + [[package]] name = "proc-macro2" version = "0.4.30" @@ -1067,7 +1087,7 @@ checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ "autocfg 0.1.8", "libc", - "rand_chacha", + "rand_chacha 0.1.1", "rand_core 0.4.2", "rand_hc", "rand_isaac", @@ -1078,6 +1098,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand_chacha" version = "0.1.1" @@ -1088,6 +1119,16 @@ dependencies = [ "rand_core 0.3.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -1103,6 +1144,15 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "rand_hc" version = "0.1.0" @@ -1448,7 +1498,7 @@ checksum = "e47de81184793b9a77ac66cd33ee32fe6620de957a0f3e8c5e25d218ebdeb348" dependencies = [ "interpolation", "piston_window", - "rand", + "rand 0.6.5", "serde", "serde_derive", "serde_json", @@ -1460,6 +1510,7 @@ name = "ulohy" version = "0.1.0" dependencies = [ "pyo3", + "rand 0.8.5", "turtle", ] @@ -1506,6 +1557,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wayland-client" version = "0.21.13" @@ -1716,3 +1773,24 @@ name = "xml-rs" version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af310deaae937e48a26602b730250b4949e125f468f11e6990be3e5304ddd96f" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2 1.0.92", + "quote 1.0.37", + "syn 2.0.89", +] diff --git a/Cargo.toml b/Cargo.toml index 59732c8..d34a7a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,5 @@ opt-level = 3 [dependencies] pyo3 = { version = "0.23.3", features = ["auto-initialize"] } +rand = "0.8.5" turtle = "1.0.0-rc.3" diff --git a/src/u8.rs b/src/u8.rs index da0f5d9..4dc2933 100644 --- a/src/u8.rs +++ b/src/u8.rs @@ -1 +1,24 @@ -pub fn main() {} +pub fn main() { + let mut a1 = 0; + let mut a2 = 0; + let mut a3 = 0; + let mut a4 = 0; + let mut a5 = 0; + + for _ in 0..30 { + let randnum = rand::random::(); + let randnum = randnum * 5.0; + let randnum = randnum as i32; + + match randnum { + 0 => a1 += 1, + 1 => a2 += 1, + 2 => a3 += 1, + 3 => a4 += 1, + 4 => a5 += 1, + _ => panic!("Invalid number"), + } + } + + println!("a1: {}, a2: {}, a3: {}, a4: {}, a5: {}", a1, a2, a3, a4, a5); +}