| { | ||
| "git": { | ||
| "sha1": "728a5b503ff233098d9808d572295c4c4f652cd7" | ||
| "sha1": "7a1cc2c69ebde6cb3442809213db3fe19a2cb0ba" | ||
| }, | ||
| "path_in_vcs": "" | ||
| } |
+30
-4
@@ -7,7 +7,33 @@ #![feature(test)] | ||
| use test::Bencher; | ||
| use wyhash::WyRng; | ||
| /// Exposes wyhash's RNG through the rand traits | ||
| struct WyRng(u64); | ||
| impl rand::TryRng for WyRng { | ||
| type Error = std::convert::Infallible; | ||
| fn try_next_u32(&mut self) -> Result<u32, Self::Error> { | ||
| Ok(wyhash::wyrng(&mut self.0) as u32) | ||
| } | ||
| fn try_next_u64(&mut self) -> Result<u64, Self::Error> { | ||
| Ok(wyhash::wyrng(&mut self.0)) | ||
| } | ||
| fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), Self::Error> { | ||
| for chunk in dst.chunks_mut(8) { | ||
| let bytes = wyhash::wyrng(&mut self.0).to_le_bytes(); | ||
| chunk.copy_from_slice(&bytes[..chunk.len()]); | ||
| } | ||
| Ok(()) | ||
| } | ||
| } | ||
| fn wyrng() -> WyRng { | ||
| WyRng(rand::random()) | ||
| } | ||
| #[bench] | ||
| fn shuffle_wyhash(b: &mut Bencher) { | ||
| let mut rng = WyRng::from_rng(&mut rand::rng()); | ||
| let mut rng = wyrng(); | ||
| let mut x = (0..100).collect::<Vec<usize>>(); | ||
@@ -32,3 +58,3 @@ b.iter(|| { | ||
| fn u8_wyhash(b: &mut Bencher) { | ||
| let mut rng = WyRng::from_rng(&mut rand::rng()); | ||
| let mut rng = wyrng(); | ||
| b.iter(|| { | ||
@@ -57,3 +83,3 @@ let mut sum = 0u8; | ||
| fn u32_wyhash(b: &mut Bencher) { | ||
| let mut rng = WyRng::from_rng(&mut rand::rng()); | ||
| let mut rng = wyrng(); | ||
| b.iter(|| { | ||
@@ -60,0 +86,0 @@ let mut sum = 0u32; |
+37
-67
@@ -51,4 +51,24 @@ # This file is automatically @generated by Cargo. | ||
| [[package]] | ||
| name = "chacha20" | ||
| version = "0.10.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" | ||
| dependencies = [ | ||
| "cfg-if", | ||
| "cpufeatures", | ||
| "rand_core 0.10.1", | ||
| ] | ||
| [[package]] | ||
| name = "cpufeatures" | ||
| version = "0.3.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" | ||
| dependencies = [ | ||
| "libc", | ||
| ] | ||
| [[package]] | ||
| name = "fastrand" | ||
| version = "2.4.1" | ||
| version = "2.5.0" | ||
| dependencies = [ | ||
@@ -94,5 +114,5 @@ "getrandom", | ||
| name = "getrandom" | ||
| version = "0.3.4" | ||
| version = "0.4.3" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" | ||
| checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" | ||
| dependencies = [ | ||
@@ -103,3 +123,3 @@ "cfg-if", | ||
| "r-efi", | ||
| "wasip2", | ||
| "rand_core 0.10.1", | ||
| "wasm-bindgen", | ||
@@ -196,11 +216,2 @@ ] | ||
| [[package]] | ||
| name = "ppv-lite86" | ||
| version = "0.2.21" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" | ||
| dependencies = [ | ||
| "zerocopy", | ||
| ] | ||
| [[package]] | ||
| name = "proc-macro2" | ||
@@ -225,34 +236,28 @@ version = "1.0.105" | ||
| name = "r-efi" | ||
| version = "5.3.0" | ||
| version = "6.0.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" | ||
| checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" | ||
| [[package]] | ||
| name = "rand" | ||
| version = "0.9.2" | ||
| version = "0.10.2" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" | ||
| checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" | ||
| dependencies = [ | ||
| "rand_chacha", | ||
| "rand_core", | ||
| "chacha20", | ||
| "getrandom", | ||
| "rand_core 0.10.1", | ||
| ] | ||
| [[package]] | ||
| name = "rand_chacha" | ||
| version = "0.9.0" | ||
| name = "rand_core" | ||
| version = "0.9.5" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" | ||
| dependencies = [ | ||
| "ppv-lite86", | ||
| "rand_core", | ||
| ] | ||
| checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" | ||
| [[package]] | ||
| name = "rand_core" | ||
| version = "0.9.5" | ||
| version = "0.10.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" | ||
| dependencies = [ | ||
| "getrandom", | ||
| ] | ||
| checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" | ||
@@ -357,11 +362,2 @@ [[package]] | ||
| [[package]] | ||
| name = "wasip2" | ||
| version = "1.0.2+wasi-0.2.9" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" | ||
| dependencies = [ | ||
| "wit-bindgen", | ||
| ] | ||
| [[package]] | ||
| name = "wasm-bindgen" | ||
@@ -499,8 +495,2 @@ version = "0.2.108" | ||
| [[package]] | ||
| name = "wit-bindgen" | ||
| version = "0.51.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" | ||
| [[package]] | ||
| name = "wyhash" | ||
@@ -511,26 +501,6 @@ version = "0.6.0" | ||
| dependencies = [ | ||
| "rand_core", | ||
| "rand_core 0.9.5", | ||
| ] | ||
| [[package]] | ||
| name = "zerocopy" | ||
| version = "0.8.33" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" | ||
| dependencies = [ | ||
| "zerocopy-derive", | ||
| ] | ||
| [[package]] | ||
| name = "zerocopy-derive" | ||
| version = "0.8.33" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" | ||
| dependencies = [ | ||
| "proc-macro2", | ||
| "quote", | ||
| "syn", | ||
| ] | ||
| [[package]] | ||
| name = "zmij" | ||
@@ -537,0 +507,0 @@ version = "1.0.16" |
+5
-5
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "fastrand" | ||
| version = "2.4.1" | ||
| version = "2.5.0" | ||
| authors = ["Stjepan Glavina <stjepang@gmail.com>"] | ||
@@ -72,6 +72,6 @@ build = false | ||
| [dev-dependencies.getrandom] | ||
| version = "0.3.4" | ||
| version = "0.4" | ||
| [dev-dependencies.rand] | ||
| version = "0.9" | ||
| version = "0.10" | ||
@@ -82,3 +82,3 @@ [dev-dependencies.wyhash] | ||
| [target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dependencies.getrandom] | ||
| version = "0.3.4" | ||
| version = "0.4" | ||
| features = ["wasm_js"] | ||
@@ -88,3 +88,3 @@ optional = true | ||
| [target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dev-dependencies.getrandom] | ||
| version = "0.3.4" | ||
| version = "0.4" | ||
| features = ["wasm_js"] | ||
@@ -91,0 +91,0 @@ |
+4
-0
@@ -0,1 +1,5 @@ | ||
| # Version 2.5.0 | ||
| - Update `getrandom` to 0.4. (#131) | ||
| # Version 2.4.1 | ||
@@ -2,0 +6,0 @@ |
+5
-5
| # fastrand | ||
| []( | ||
| []( | ||
| https://github.com/smol-rs/fastrand/actions) | ||
@@ -43,3 +43,3 @@ []( | ||
| Sample values from an array with `O(n)` complexity (`n` is the length of array): | ||
| Sample values from an array with `O(n)` complexity (`n` is the length of the array): | ||
@@ -83,3 +83,3 @@ ```rust | ||
| let rng = fastrand::Rng::new(); | ||
| let mut rng = fastrand::Rng::new(); | ||
| let mut bytes: Vec<u8> = repeat_with(|| rng.u8(..)).take(10_000).collect(); | ||
@@ -103,4 +103,4 @@ ``` | ||
| * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) | ||
| * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) | ||
| * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0) | ||
| * MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/license/mit) | ||
@@ -107,0 +107,0 @@ at your option. |
@@ -88,3 +88,3 @@ //! A global, thread-local random number generator. | ||
| /// Generates a random `char` in ranges a-z and A-Z. | ||
| /// Generates a random `char` in range a-z and A-Z. | ||
| #[inline] | ||
@@ -95,3 +95,3 @@ pub fn alphabetic() -> char { | ||
| /// Generates a random `char` in ranges a-z, A-Z and 0-9. | ||
| /// Generates a random `char` in range a-z, A-Z and 0-9. | ||
| #[inline] | ||
@@ -130,3 +130,3 @@ pub fn alphanumeric() -> char { | ||
| /// | ||
| /// Digits are represented by `char`s in ranges 0-9 and a-z. | ||
| /// Digits are represented by `char`s in range 0-9 and a-z. | ||
| /// | ||
@@ -133,0 +133,0 @@ /// Panics if the base is zero or greater than 36. |
+4
-4
@@ -32,3 +32,3 @@ //! A simple and fast random number generator. | ||
| //! | ||
| //! Sample values from an array with `O(n)` complexity (`n` is the length of array): | ||
| //! Sample values from an array with `O(n)` complexity (`n` is the length of the array): | ||
| //! | ||
@@ -326,3 +326,3 @@ //! ``` | ||
| /// Generates a random `char` in ranges a-z and A-Z. | ||
| /// Generates a random `char` in range a-z and A-Z. | ||
| #[inline] | ||
@@ -334,3 +334,3 @@ pub fn alphabetic(&mut self) -> char { | ||
| /// Generates a random `char` in ranges a-z, A-Z and 0-9. | ||
| /// Generates a random `char` in range a-z, A-Z and 0-9. | ||
| #[inline] | ||
@@ -350,3 +350,3 @@ pub fn alphanumeric(&mut self) -> char { | ||
| /// | ||
| /// Digits are represented by `char`s in ranges 0-9 and a-z. | ||
| /// Digits are represented by `char`s in range 0-9 and a-z. | ||
| /// | ||
@@ -353,0 +353,0 @@ /// Panics if the base is zero or greater than 36. |
Sorry, the diff of this file is not supported yet