35 Commits

Author SHA1 Message Date
Paul Dicker
c096a7ee58 Reword ISAAC documentation 2018-03-29 10:40:52 +02:00
Diggory Hardy
d32be35517 Implement various Clippy suggestions
Many lints were disabled due to low or nil utility, and a few suggestions
ignored in the interests of readability or correctness. Command:

~/.cargo/bin/cargo-clippy --features=log,nightly,serde-1 -- -A inline_always -A approx_constant -A unreadable_literal -A cast_lossless -A len_zero -A unit_arg -A many_single_char_names -A doc_markdown -A single_match -A transmute_int_to_float -A float_cmp -A identity_op -A too_many_arguments -A new_ret_no_self
2018-03-27 15:22:14 +01:00
Paul Dicker
bdf509edcf Deprecate new_unseeded functions 2018-03-24 17:14:42 +01:00
Diggory Hardy
055af91c33 SeedableRng::from_rng: avoid &mut on argument where unnecessary
This is the motivation for the previous commit.
2018-03-23 10:00:33 +00:00
Diggory Hardy
4efdd14eac SeedableRng::from_rng: prefer to move argument 2018-03-23 10:00:33 +00:00
Diggory Hardy
336d224362 Merge pull request #288 from dhardy/core
Add rand-core sub-crate and update version numbers
2018-03-14 10:46:58 +00:00
Diggory Hardy
9db76985ca RngCore: remove default implementations of functions 2018-03-14 10:34:33 +00:00
Bastien Orivel
b60f1aac37 Bump bincode to 1.0 2018-03-11 16:16:04 +01:00
Diggory Hardy
dab89ab07c Add rand-core sub-crate and update version numbers
This moves core traits/types/impls to rand-core
impls and le modules are now public (from rand-core only)
CI tweaks, needed since not all features are duplicated on rand-core
Cross-crate doc links now use full URLs (is there a better option?)
2018-03-10 11:31:19 +00:00
Diggory Hardy
60a6c72e2d Split Rng into RngCore and extension Rng: RngCore 2018-02-19 14:55:07 +00:00
Diggory Hardy
5e28ec9945 from_rng should not consume its argument 2018-02-15 12:21:54 +00:00
Paul Dicker
469b1c16cb Fix serde tests 2018-01-25 21:25:31 +01:00
Diggory Hardy
71fa685021 Merge branch 'master' into seedable_rng 2018-01-23 11:18:49 +00:00
Zoe Juozapaitis
e0feb9cd8a Isaac Serde 2018-01-21 21:23:55 -08:00
Paul Dicker
cdc09e530a Make Fill_via_u*_chunks not modify src 2018-01-20 20:02:42 +01:00
Paul Dicker
c492299410 Rework SeedableRng trait 2018-01-14 15:23:49 +01:00
Diggory Hardy
a2f99f88d0 Isaac64: shorten seeds and update results
The planned switch to 256-bit byte array seeds does not allow such long seeds.
2018-01-14 13:44:52 +00:00
Diggory Hardy
048ff53250 Merge pull request #226 from pitdicker/fix_docs
Fix documentation warnings
2018-01-12 10:34:33 +00:00
Paul Dicker
cb8e38f3af Test PRNGs without allocating 2018-01-10 07:30:55 +01:00
Paul Dicker
c6cd88ad1c Fix documentation differences 2018-01-10 07:21:08 +01:00
Gabriel Majeri
1e39123121 Add more links 2018-01-09 08:39:55 +02:00
Gabriel Majeri
2da42d488c Merge branch 'master' into https 2018-01-09 08:35:22 +02:00
Diggory Hardy
b7c817d631 Revert some breaking changes
Restore default implementations of next_u64 and fill_bytes
Restore new_unseeded functions (as wrappers)
2017-12-27 11:58:57 +00:00
Paul Dicker
a2255db397 Add test for alternating between next_u64 and next_u32
[Cherry-picked from 5f4bedf78c]
2017-12-27 11:49:19 +00:00
Paul Dicker
ef69ab8b01 Improve performance of isaac64::next_u32.
This is 45% faster. We are no longer throwing away half of the results.

[Cherry-picked from 415ef6f440cce and 0bdb1c3926]
2017-12-27 11:49:19 +00:00
Paul Dicker
6ad5a2c86b Fill isaac64 backwards, and use fill_via_u32_chunks
[Cherry-picked from 707c3e109209962]
2017-12-27 11:49:19 +00:00
Diggory Hardy
72eac0b014 Isaac64: add test for true 32-bit values
Includes both the values output now and the values which should be output by #36.

[Cherry-picked from fd2660b54272653]
2017-12-27 11:49:19 +00:00
Diggory Hardy
c119d96167 Add true_bytes tests for ChaCha and Isaac; fix 2 bugs in fill_bytes impls
[Cherry-picked from ae365ef352eeb0a]
2017-12-27 11:49:19 +00:00
Paul Dicker
c86c19cf87 Custom Debug implementation for ChaCha and Xorshift
So the internal state is never exposed (may be security-sensitive)

[Cherry-picked from e513aaa8e2d933]
2017-12-27 11:49:19 +00:00
Paul Dicker
5c367f5baa Simplify isaac init code
[Cherry-picked from 130b64c00fe94]
2017-12-27 11:49:19 +00:00
Diggory Hardy
38e16ed95d Add new_from_u64 to IsaacRng and Isaac64Rng
Cherry-picked from adcd8e56595a6 [by Paul Dicker, 19th October]

I have implemented it as a function instead of a trait, as that makes it easy to
add it to every RNG ont at a time.

I split the `init` function in two instead of the current version that uses a
bool to select between two paths. This makes it more clear how the seed is used.
The current `mix` macro has to be defined in the function, and would have to be
duplicated. Therefore I converted it to a seperate function.

I precalculated the values a...h, but am not sure this is a good idea. It makes
the resulting code smaller, and gives a small performance win. Because it are
'magic' values anyway, I thought why not?
2017-12-27 11:49:19 +00:00
Paul Dicker
a5d006180d Add some extra documentation
[Cherry-picked from 14d05616b8]
2017-12-27 11:49:19 +00:00
Diggory Hardy
45b70d6ace Add impls module; replace custom impls; remove default impls
for next_u64 and fill_bytes

This is based on dd1241a256f2 but heavily modified
2017-12-27 11:49:19 +00:00
Paul Dicker
eafd4ee266 Refactor isaac.rs
This removes the unsafe blocks from the main isaac and isaac64 routines.
Some macro's are replaced by functions.
Over time the implementation of ISAAC and ISAAC-64 have diverged a bit, now they
are as similar as possible (for easier comparison).

The code is tested against the previous implementation, and the reference
implementation. IsaacRng now does 34% better in the benchmark.

[Cherry-picked from 4747665d228]
2017-12-27 11:43:14 +00:00
Diggory Hardy
1c6e2dc9f5 Move Issac64Rng to its own module
This mirrors ec7e6bf7dc47 but without IsaacWordRng
2017-12-17 17:55:31 +00:00