num-complex
Advanced tools
| { | ||
| "git": { | ||
| "sha1": "ce0637be7d2cfb43d505b37b670617e4dc18e9e6" | ||
| "sha1": "3a89daa2c616154035dd27d706bf7938bcbf30a8" | ||
| } | ||
| } |
+2
-2
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "num-complex" | ||
| version = "0.3.1" | ||
| version = "0.4.0" | ||
| authors = ["The Rust Project Developers"] | ||
@@ -36,3 +36,3 @@ exclude = ["/bors.toml", "/ci/*", "/.github/*"] | ||
| [dependencies.rand] | ||
| version = "0.7" | ||
| version = "0.8" | ||
| optional = true | ||
@@ -39,0 +39,0 @@ default-features = false |
+2
-2
@@ -16,3 +16,3 @@ # num-complex | ||
| [dependencies] | ||
| num-complex = "0.3" | ||
| num-complex = "0.4" | ||
| ``` | ||
@@ -27,3 +27,3 @@ | ||
| [dependencies.num-complex] | ||
| version = "0.3" | ||
| version = "0.4" | ||
| default-features = false | ||
@@ -30,0 +30,0 @@ ``` |
+6
-0
@@ -0,1 +1,7 @@ | ||
| # Release 0.4.0 (2021-03-05) | ||
| - `rand` support has been updated to 0.8, requiring Rust 1.36. | ||
| **Contributors**: @cuviper | ||
| # Release 0.3.1 (2020-10-29) | ||
@@ -2,0 +8,0 @@ |
+35
-2
@@ -45,4 +45,37 @@ //! Rand implementations for complex numbers | ||
| #[cfg(test)] | ||
| fn test_rng() -> StdRng { | ||
| StdRng::from_seed([42; 32]) | ||
| fn test_rng() -> impl RngCore { | ||
| /// Simple `Rng` for testing without additional dependencies | ||
| struct XorShiftStar { | ||
| a: u64, | ||
| } | ||
| impl RngCore for XorShiftStar { | ||
| fn next_u32(&mut self) -> u32 { | ||
| self.next_u64() as u32 | ||
| } | ||
| fn next_u64(&mut self) -> u64 { | ||
| // https://en.wikipedia.org/wiki/Xorshift#xorshift* | ||
| self.a ^= self.a >> 12; | ||
| self.a ^= self.a << 25; | ||
| self.a ^= self.a >> 27; | ||
| self.a.wrapping_mul(0x2545_F491_4F6C_DD1D) | ||
| } | ||
| fn fill_bytes(&mut self, dest: &mut [u8]) { | ||
| for chunk in dest.chunks_mut(8) { | ||
| let bytes = self.next_u64().to_le_bytes(); | ||
| let slice = &bytes[..chunk.len()]; | ||
| chunk.copy_from_slice(slice) | ||
| } | ||
| } | ||
| fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> { | ||
| Ok(self.fill_bytes(dest)) | ||
| } | ||
| } | ||
| XorShiftStar { | ||
| a: 0x0123_4567_89AB_CDEF, | ||
| } | ||
| } | ||
@@ -49,0 +82,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display