Commit Graph

166 Commits

Author SHA1 Message Date
Vinzent Steinberg 67f491a7a5 rand_core: Fix clippy warnings 2021-05-08 21:35:09 -03:00
Alexander Batischev 25c1c49541 RngCore: explain what a pathological RNG will break
Cf. https://github.com/rust-random/rngs/pull/25#discussion_r622770225.
2021-04-30 14:41:07 +03:00
Tyler Mandry 2cf5120dd5 Bump to 0.6.2 2021-02-12 17:47:10 -08:00
Tyler Mandry 390a7b1049 Fix assertions inside read_{u32,u64}_into
Unless I'm mistaken the size multiplier was on the wrong side, making the assertions too permissive. This could have resulted in destination buffers not being fully populated.
2021-02-10 18:55:08 -08:00
Diggory Hardy 594aed8291 seed_from_u64: use newpavlov's suggestion 2021-01-02 10:17:31 +00:00
Diggory Hardy eb4b8a44d3 Fix #1082 (seed_from_u64 with non multiple of 4) 2021-01-01 14:34:38 +00:00
Taiki Endo a63eb3ad36 Prepare rand_core 0.6.1 2020-12-31 23:06:56 +09:00
Taiki Endo 3c19b97b7a Enable all stable features in the playground 2020-12-31 15:59:10 +09:00
Diggory Hardy 1959b1adac Adjust homepage to point at the book 2020-12-15 10:13:17 +00:00
Diggory Hardy e9adf451c5 Switch documentation links to docs.rs 2020-12-15 10:08:34 +00:00
Diggory Hardy d95dbd2f93 Prepare rand_core 0.6.0 2020-12-14 14:43:45 +00:00
Diggory Hardy 0f53b56870 Update README files shields and doc 2020-12-13 11:00:07 +00:00
Diggory Hardy 8caa86b666 Cargo.toml: remove [badges] sections
According to the Cargo manifest, this section is not used
and the README should be used for build status.
2020-12-13 11:00:07 +00:00
Diggory Hardy fde4113cad Document available error codes 2020-10-27 22:10:42 +01:00
Diggory Hardy d8f4ec8e3a Update changelog(s), esp. for rand_core v0.6 2020-10-27 22:10:42 +01:00
Diggory Hardy de579bede6 Fix next_u32_via_fill and next_u64_via_fill to use LE conversion as documented 2020-10-27 22:10:42 +01:00
Vinzent Steinberg 14ba1bbb4d Fix some clippy warnings
Also reenable some lints that no longer cause warnings.
2020-10-09 12:08:15 +02:00
Joseph Richey 85c32ff8e6 Update getrandom to 0.2 (#1041)
* Update getrandom to 0.2
* Make sure that the error codes are identical to `getrandom`
* rand_core: Add links to Error cross-refs

Signed-off-by: Joe Richey <joerichey@google.com>
Co-authored-by: Vinzent Steinberg <Vinzent.Steinberg@gmail.com>
2020-09-15 03:57:44 -07:00
Vinzent Steinberg 5bd9dcf642 Delete dead code 2020-08-28 15:31:56 +02:00
Vinzent Steinberg e88f2cba06 Restore unsafe fill_via_chunks implementation for performance 2020-08-28 15:31:56 +02:00
Vinzent Steinberg 9ccdffd095 Simplify code 2020-08-28 15:31:56 +02:00
Vinzent Steinberg dae0d96286 Check source size and prefer chunks_exact 2020-08-28 15:31:56 +02:00
Vinzent Steinberg ad08968b00 Use chunks_exact_mut for slightly better performance
The results from master, using unsafe code:
```
gen_bytes_chacha12:   2,733,838 ns/iter (+/- 181,694) = 374 MB/s
gen_bytes_chacha20:   4,339,602 ns/iter (+/- 237,793) = 235 MB/s
gen_bytes_chacha8:    1,918,279 ns/iter (+/- 103,581) = 533 MB/s
```

The results of the new code using `chunks_exact_mut` (this commit):
```
gen_bytes_chacha12:   3,049,147 ns/iter (+/- 220,631)   = 335 MB/s
gen_bytes_chacha20:   4,645,772 ns/iter (+/- 269,261)   = 220 MB/s
gen_bytes_chacha8:    2,214,954 ns/iter (+/- 1,745,600) = 462 MB/s
```

The results of using `chunks_mut` (before this commit):
```
gen_bytes_chacha12:   3,492,109 ns/iter (+/- 164,638) = 293 MB/s
gen_bytes_chacha20:   5,087,706 ns/iter (+/- 249,219) = 201 MB/s
gen_bytes_chacha8:    2,700,197 ns/iter (+/- 524,148) = 379 MB/s
```
2020-08-28 15:31:56 +02:00
Vinzent Steinberg 4bb5cfa485 Simplify macro 2020-08-28 15:31:56 +02:00
Vinzent Steinberg f87ef95344 Fix fill_via_chunks and add tests 2020-08-28 15:31:56 +02:00
Vinzent Steinberg 1589af3543 Try to fix endianess issue 2020-08-28 15:31:56 +02:00
Vinzent Steinberg 812e7b35f8 Simplify cfg logic
This is possible thanks to `alloc` being implied by `std` builds since
Rust 1.36.
2020-08-28 15:31:56 +02:00
Vinzent Steinberg 80801fb78e Avoid indexing 2020-08-28 15:31:56 +02:00
Vinzent Steinberg c3f0a30ddd Drop some unsafe code from rand_core
The necessary standard library functions were stabilized with Rust 1.34.
Our MSRV is 1.36.
2020-08-28 15:31:56 +02:00
Vinzent Steinberg 7555747c16 Bump MSRV to 1.36 2020-08-28 15:31:56 +02:00
Diggory Hardy cb493927e6 Use doc(cfg) to annotate feature-gated items (#1019)
* Use doc(cfg) to annotate feature-gated items
* Fix block RNG example
* Formatting (partial rustfmt run)
2020-08-27 10:20:28 +01:00
Diggory Hardy 4103a35f1c Merge pull request #963 from Shnatsel/safe_read_u64
Drop unsafe code from next_u64
2020-04-06 09:08:45 +01:00
Sergey "Shnatsel" Davidoff 5489851e73 Use .to_le_bytes() instead of .to_le().to_ne_bytes() 2020-04-05 14:50:55 +02:00
Sergey "Shnatsel" Davidoff f9f59833e0 Drop unsafe code from next_u64 2020-04-04 15:17:15 +02:00
Sergey "Shnatsel" Davidoff 93ee2fdb41 Drop unsafe code from SeedableRng::seed_from_u64 2020-04-04 04:09:13 +02:00
vallentin 3b169844ba Fixed misspellings 2020-02-07 06:56:03 +01:00
Diggory Hardy 0b1694c1e3 rustfmt: moving assoc. type and const definitions 2020-01-02 15:46:14 +00:00
Diggory Hardy e927d31ff3 rustfmt: expression spacing across lines (excluding if conditions) 2020-01-02 15:46:14 +00:00
Diggory Hardy 92e07018e0 rustfmt: expression spacing (on the line) 2020-01-02 15:46:14 +00:00
Diggory Hardy 0f9500b725 rustfmt: function parameters 2020-01-02 15:46:14 +00:00
Diggory Hardy 61317ff0ef rustfmt: macro parameters and definition 2020-01-02 15:46:14 +00:00
Diggory Hardy 079ff0d541 rustfmt: function specifications 2020-01-02 15:46:14 +00:00
Diggory Hardy 363571540f rustfmt: method chaining 2020-01-02 15:46:14 +00:00
Diggory Hardy 4f1f0fce67 rustfmt: struct literals, if/for blocks 2020-01-02 15:46:14 +00:00
Diggory Hardy 88c7f5e296 rustfmt: where clauses and super traits 2020-01-02 15:46:14 +00:00
Diggory Hardy 477b47058f rustfmt: spacing, new-lines, trailing commas/semicolon 2020-01-02 15:46:14 +00:00
Diggory Hardy ccb64dc0a0 rustfmt: attributes 2020-01-02 15:46:14 +00:00
Diggory Hardy 7a181deca6 rustfmt: initial attributes, mod and use statements 2020-01-02 15:46:14 +00:00
Diggory Hardy 88aa915c66 rustfmt: use, mod statements and initial attributes 2020-01-02 15:46:14 +00:00
Diggory Hardy 8ae52a2341 doc: Tweak link names for RngCore methods 2020-01-01 13:05:23 +00:00