diff --git a/.github/workflows/benches.yml b/.github/workflows/benches.yml new file mode 100644 index 00000000..f0112ec8 --- /dev/null +++ b/.github/workflows/benches.yml @@ -0,0 +1,26 @@ +name: Benches + +on: + pull_request: + paths: + - ".github/workflows/benches.yml" + - "benches/**" + +jobs: + benches: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./benches + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + components: clippy, rustfmt + - name: Rustfmt + run: cargo fmt -- --check + - name: Clippy + run: cargo clippy --all-targets -- -D warnings + - name: Build + run: RUSTFLAGS=-Dwarnings cargo build --all-targets diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e11be4c7..d3f76c1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,13 +14,9 @@ jobs: name: Check doc runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true + uses: dtolnay/rust-toolchain@nightly - run: cargo install cargo-deadlinks - name: doc (rand) env: @@ -48,6 +44,10 @@ jobs: target: x86_64-pc-windows-msvc toolchain: beta # Test both windows-gnu and windows-msvc; use beta rust on one + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + variant: MSRV + toolchain: 1.61.0 - os: ubuntu-latest deps: sudo apt-get update ; sudo apt install gcc-multilib target: i686-unknown-linux-gnu @@ -58,18 +58,20 @@ jobs: variant: minimal_versions steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: MSRV + if: ${{ matrix.variant == 'MSRV' }} + run: cp Cargo.lock.msrv Cargo.lock - name: Install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - profile: minimal - target: ${{ matrix.target }} + targets: ${{ matrix.target }} toolchain: ${{ matrix.toolchain }} - override: true - run: ${{ matrix.deps }} - name: Maybe minimal versions if: ${{ matrix.variant == 'minimal_versions' }} - run: cargo generate-lockfile -Z minimal-versions + run: | + cargo generate-lockfile -Z minimal-versions - name: Maybe nightly if: ${{ matrix.toolchain == 'nightly' }} run: | @@ -82,32 +84,6 @@ jobs: cargo test --target ${{ matrix.target }} --manifest-path rand_xoshiro/Cargo.toml --all-features cargo test --target ${{ matrix.target }} --manifest-path rand_jitter/Cargo.toml --all-features - msrv: - name: MSRV for rand_isaac / rand_xorshift / rand_xoshiro - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.56.0 # older versions may work (untested) - - run: cd rand_isaac && cargo test --all-features - - run: cd rand_xorshift && cargo test --all-features - - run: cd rand_xoshiro && cargo test --all-features - - msrv_hc: - name: MSRV for rand_hc - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.36.0 - - run: cd rand_hc && cargo test --all-features - - msrv_jitter: - name: MSRV for rand_jitter - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.51.0 - - run: cd rand_jitter && cargo test --features std - test-cross: runs-on: ubuntu-latest strategy: @@ -117,14 +93,12 @@ jobs: toolchain: [stable] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - profile: minimal - target: ${{ matrix.target }} + targets: ${{ matrix.target }} toolchain: ${{ matrix.toolchain }} - override: true - name: Cache cargo plugins uses: actions/cache@v1 with: @@ -143,7 +117,7 @@ jobs: test-miri: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install toolchain run: | MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri) diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv new file mode 100644 index 00000000..78690a3a --- /dev/null +++ b/Cargo.lock.msrv @@ -0,0 +1,712 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "benches" +version = "0.1.0" +dependencies = [ + "criterion", + "criterion-cycles-per-byte", + "rand_core", + "rand_hc", + "rand_isaac", + "rand_xorshift", + "rand_xoshiro", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "clap" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +dependencies = [ + "anstyle", + "clap_lex", +] + +[[package]] +name = "clap_lex" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" + +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "is-terminal", + "itertools", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-cycles-per-byte" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5281161544b8f2397e14942c2045efa3446470348121a65c37263f8e76c1e2ff" +dependencies = [ + "criterion", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "is-terminal" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + +[[package]] +name = "plotters" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" + +[[package]] +name = "plotters-svg" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +dependencies = [ + "plotters-backend", +] + +[[package]] +name = "proc-macro2" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", + "serde", +] + +[[package]] +name = "rand_hc" +version = "0.3.2" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_isaac" +version = "0.3.0" +dependencies = [ + "bincode", + "rand_core", + "serde", + "serde_derive", +] + +[[package]] +name = "rand_jitter" +version = "0.4.0" +dependencies = [ + "libc", + "log", + "rand_core", + "winapi", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +dependencies = [ + "bincode", + "rand_core", + "serde", +] + +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +dependencies = [ + "bincode", + "rand_core", + "serde", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "regex" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "serde" +version = "1.0.202" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.202" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "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 = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/Cargo.toml b/Cargo.toml index 7abebd29..f9cc4350 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,17 +1,3 @@ -[package] -name = "rngs" -version = "0.0.0" -authors = ["The Rand Project Developers", "The Rust Project Developers"] -license = "MIT OR Apache-2.0" -readme = "README.md" -repository = "https://github.com/rust-random/rngs" -description = """ -Extra random number generators -""" -autobenches = true -edition = "2018" -publish = false - [workspace] members = [ "rand_jitter", @@ -20,17 +6,7 @@ members = [ "rand_xoshiro", "rand_hc", ] - -[dev-dependencies] -# Only for benches: -criterion = "0.3.5" -criterion-cycles-per-byte = "0.1.2" -rand_core = { version = "0.6", features = ["getrandom"] } -rand_xoshiro = { path = "rand_xoshiro", version = "0.6" } -rand_isaac = { path = "rand_isaac", version = "0.3" } -rand_xorshift = { path = "rand_xorshift", version = "0.3" } -rand_hc = { path = "rand_hc", version = "0.3" } - -[[bench]] -name = "mod" -harness = false +exclude = [ + "benches", +] +resolver = "2" diff --git a/README.md b/README.md index e9d6cdd5..8e5baf87 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Test Status](https://github.com/rust-random/rngs/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rngs/actions) [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.36+-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.61-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements) Extra random number generators provided by the Rust Random project. The main repository, [rust-random/rand](https://github.com/rust-random/rand), diff --git a/benches/Cargo.toml b/benches/Cargo.toml new file mode 100644 index 00000000..4214bbd5 --- /dev/null +++ b/benches/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "benches" +version = "0.1.0" +edition = "2021" +rust-version = "1.61" +publish = false + +[dependencies] + +[dev-dependencies] +criterion = "0.5.0" +criterion-cycles-per-byte = "0.6" +rand_core = { version = "0.6.4", features = ["getrandom"] } +rand_xoshiro = { path = "../rand_xoshiro", version = "0.6" } +rand_isaac = { path = "../rand_isaac", version = "0.3" } +rand_xorshift = { path = "../rand_xorshift", version = "0.3" } +rand_hc = { path = "../rand_hc", version = "0.3" } + +[[bench]] +name = "mod" +path = "mod.rs" +harness = false diff --git a/benches/mod.rs b/benches/mod.rs index 37b0b042..216224ae 100644 --- a/benches/mod.rs +++ b/benches/mod.rs @@ -106,15 +106,45 @@ fn gen_uint(c: &mut Criterion) { g.throughput(Throughput::Bytes(size_of::() as u64 * RAND_BENCH_N)); gen_uint!(g, "xorshift", u32, XorShiftRng::from_entropy()); - gen_uint!(g, "xoshiro256starstar", u32, Xoshiro256StarStar::from_entropy()); + gen_uint!( + g, + "xoshiro256starstar", + u32, + Xoshiro256StarStar::from_entropy() + ); gen_uint!(g, "xoshiro256plus", u32, Xoshiro256Plus::from_entropy()); - gen_uint!(g, "xoshiro256plusplus", u32, Xoshiro256PlusPlus::from_entropy()); - gen_uint!(g, "xoshiro128starstar", u32, Xoshiro128StarStar::from_entropy()); + gen_uint!( + g, + "xoshiro256plusplus", + u32, + Xoshiro256PlusPlus::from_entropy() + ); + gen_uint!( + g, + "xoshiro128starstar", + u32, + Xoshiro128StarStar::from_entropy() + ); gen_uint!(g, "xoshiro128plus", u32, Xoshiro128Plus::from_entropy()); - gen_uint!(g, "xoshiro128plusplus", u32, Xoshiro128PlusPlus::from_entropy()); - gen_uint!(g, "xoroshiro128starstar", u32, Xoroshiro128StarStar::from_entropy()); + gen_uint!( + g, + "xoshiro128plusplus", + u32, + Xoshiro128PlusPlus::from_entropy() + ); + gen_uint!( + g, + "xoroshiro128starstar", + u32, + Xoroshiro128StarStar::from_entropy() + ); gen_uint!(g, "xoroshiro128plus", u32, Xoroshiro128Plus::from_entropy()); - gen_uint!(g, "xoroshiro64starstar", u32, Xoroshiro64StarStar::from_entropy()); + gen_uint!( + g, + "xoroshiro64starstar", + u32, + Xoroshiro64StarStar::from_entropy() + ); gen_uint!(g, "xoroshiro64star", u32, Xoroshiro64Star::from_entropy()); gen_uint!(g, "splitmix64", u32, SplitMix64::from_entropy()); gen_uint!(g, "hc128", u32, Hc128Rng::from_entropy()); @@ -127,15 +157,45 @@ fn gen_uint(c: &mut Criterion) { g.throughput(Throughput::Bytes(size_of::() as u64 * RAND_BENCH_N)); gen_uint!(g, "xorshift", u64, XorShiftRng::from_entropy()); - gen_uint!(g, "xoshiro256starstar", u64, Xoshiro256StarStar::from_entropy()); + gen_uint!( + g, + "xoshiro256starstar", + u64, + Xoshiro256StarStar::from_entropy() + ); gen_uint!(g, "xoshiro256plus", u64, Xoshiro256Plus::from_entropy()); - gen_uint!(g, "xoshiro256plusplus", u64, Xoshiro256PlusPlus::from_entropy()); - gen_uint!(g, "xoshiro128starstar", u64, Xoshiro128StarStar::from_entropy()); + gen_uint!( + g, + "xoshiro256plusplus", + u64, + Xoshiro256PlusPlus::from_entropy() + ); + gen_uint!( + g, + "xoshiro128starstar", + u64, + Xoshiro128StarStar::from_entropy() + ); gen_uint!(g, "xoshiro128plus", u64, Xoshiro128Plus::from_entropy()); - gen_uint!(g, "xoshiro128plusplus", u64, Xoshiro128PlusPlus::from_entropy()); - gen_uint!(g, "xoroshiro128starstar", u64, Xoroshiro128StarStar::from_entropy()); + gen_uint!( + g, + "xoshiro128plusplus", + u64, + Xoshiro128PlusPlus::from_entropy() + ); + gen_uint!( + g, + "xoroshiro128starstar", + u64, + Xoroshiro128StarStar::from_entropy() + ); gen_uint!(g, "xoroshiro128plus", u64, Xoroshiro128Plus::from_entropy()); - gen_uint!(g, "xoroshiro64starstar", u64, Xoroshiro64StarStar::from_entropy()); + gen_uint!( + g, + "xoroshiro64starstar", + u64, + Xoroshiro64StarStar::from_entropy() + ); gen_uint!(g, "xoroshiro64star", u64, Xoroshiro64Star::from_entropy()); gen_uint!(g, "splitmix64", u64, SplitMix64::from_entropy()); gen_uint!(g, "hc128", u64, Hc128Rng::from_entropy()); diff --git a/rand_hc/Cargo.toml b/rand_hc/Cargo.toml index 0f12a774..299af921 100644 --- a/rand_hc/Cargo.toml +++ b/rand_hc/Cargo.toml @@ -12,7 +12,8 @@ HC128 random number generator """ keywords = ["random", "rng", "hc128"] categories = ["algorithms", "no-std"] -edition = "2018" +edition = "2021" +rust-version = "1.61" [dependencies] rand_core = "0.6" diff --git a/rand_hc/README.md b/rand_hc/README.md index ea54a783..c9895c0a 100644 --- a/rand_hc/README.md +++ b/rand_hc/README.md @@ -5,7 +5,6 @@ [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_hc) [![API](https://docs.rs/rand_hc/badge.svg)](https://docs.rs/rand_hc) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.36+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) A cryptographically secure random number generator that uses the HC-128 algorithm. diff --git a/rand_isaac/Cargo.toml b/rand_isaac/Cargo.toml index 2f70f1b3..1db5307b 100644 --- a/rand_isaac/Cargo.toml +++ b/rand_isaac/Cargo.toml @@ -12,7 +12,8 @@ ISAAC random number generator """ keywords = ["random", "rng", "isaac"] categories = ["algorithms", "no-std"] -edition = "2018" +edition = "2021" +rust-version = "1.61" [features] serde1 = ["serde", "rand_core/serde1"] diff --git a/rand_isaac/README.md b/rand_isaac/README.md index dfff68bd..9d2e42eb 100644 --- a/rand_isaac/README.md +++ b/rand_isaac/README.md @@ -5,7 +5,6 @@ [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_isaac) [![API](https://docs.rs/rand_isaac/badge.svg)](https://docs.rs/rand_isaac) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.36+-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements) Implements the ISAAC and ISAAC-64 random number generators. diff --git a/rand_isaac/src/isaac.rs b/rand_isaac/src/isaac.rs index f833ce4b..496cd9c2 100644 --- a/rand_isaac/src/isaac.rs +++ b/rand_isaac/src/isaac.rs @@ -218,7 +218,7 @@ impl BlockRngCore for IsaacCore { let y = *a + *b + ind(mem, x, 2); mem[base + m] = y; *b = x + ind(mem, y, 2 + RAND_SIZE_LEN); - results[RAND_SIZE - 1 - base - m] = (*b).0; + results[RAND_SIZE - 1 - base - m] = b.0; } let mut m = 0; diff --git a/rand_isaac/src/isaac64.rs b/rand_isaac/src/isaac64.rs index dc252ed7..69653aa4 100644 --- a/rand_isaac/src/isaac64.rs +++ b/rand_isaac/src/isaac64.rs @@ -209,7 +209,7 @@ impl BlockRngCore for Isaac64Core { let y = *a + *b + ind(mem, x, 3); mem[base + m] = y; *b = x + ind(mem, y, 3 + RAND_SIZE_LEN); - results[RAND_SIZE - 1 - base - m] = (*b).0; + results[RAND_SIZE - 1 - base - m] = b.0; } let mut m = 0; diff --git a/rand_jitter/Cargo.toml b/rand_jitter/Cargo.toml index 00ae8839..2fae4412 100644 --- a/rand_jitter/Cargo.toml +++ b/rand_jitter/Cargo.toml @@ -8,8 +8,12 @@ repository = "https://github.com/rust-random/rngs" documentation = "https://docs.rs/rand_jitter" description = "Random number generator based on timing jitter" keywords = ["random", "rng", "os"] -edition = "2018" -rust-version = "1.51" +edition = "2021" +rust-version = "1.61" + +[features] +std = ["rand_core/std"] +log = ["dep:log"] [dependencies] rand_core = { version = "0.6" } @@ -18,10 +22,7 @@ log = { version = "0.4.4", optional = true } [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies] # We don't need the 'use_std' feature and depending on it causes # issues due to: https://github.com/rust-lang/cargo/issues/1197 -libc = { version = "0.2", default_features = false } +libc = { version = "0.2", default-features = false } [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3", features = ["profileapi"] } - -[features] -std = ["rand_core/std"] diff --git a/rand_jitter/README.md b/rand_jitter/README.md index e84e41f6..a2b901f0 100644 --- a/rand_jitter/README.md +++ b/rand_jitter/README.md @@ -5,7 +5,6 @@ [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_jitter) [![API](https://docs.rs/rand_jitter/badge.svg)](https://docs.rs/rand_jitter) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.51-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements) Non-physical true random number generator based on timing jitter. diff --git a/rand_jitter/benches/mod.rs b/rand_jitter/benches/mod.rs deleted file mode 100644 index b62d90f1..00000000 --- a/rand_jitter/benches/mod.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(test)] -#![cfg(std)] - -use rand_jitter::rand_core::RngCore; -use test::Bencher; - -#[bench] -fn bench_add_two(b: &mut Bencher) { - let mut rng = rand_jitter::JitterRng::new().unwrap(); - let mut buf = [0u8; 1024]; - b.iter(|| { - rng.fill_bytes(&mut buf[..]); - test::black_box(&buf); - }); - b.bytes = buf.len() as u64; -} diff --git a/rand_xorshift/Cargo.toml b/rand_xorshift/Cargo.toml index 78d3f5ff..aeccd7c0 100644 --- a/rand_xorshift/Cargo.toml +++ b/rand_xorshift/Cargo.toml @@ -12,7 +12,8 @@ Xorshift random number generator """ keywords = ["random", "rng", "xorshift"] categories = ["algorithms", "no-std"] -edition = "2018" +edition = "2021" +rust-version = "1.61" [features] serde1 = ["serde"] diff --git a/rand_xorshift/README.md b/rand_xorshift/README.md index c0328f3f..2142575c 100644 --- a/rand_xorshift/README.md +++ b/rand_xorshift/README.md @@ -5,7 +5,6 @@ [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_xorshift) [![API](https://docs.rs/rand_xorshift/badge.svg)](https://docs.rs/rand_xorshift) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.36+-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements) Implements the Xorshift random number generator. diff --git a/rand_xoshiro/Cargo.toml b/rand_xoshiro/Cargo.toml index a36b05d1..3d13fc3c 100644 --- a/rand_xoshiro/Cargo.toml +++ b/rand_xoshiro/Cargo.toml @@ -10,7 +10,8 @@ homepage = "https://rust-random.github.io/book" description = "Xoshiro, xoroshiro and splitmix64 random number generators" keywords = ["random", "rng"] categories = ["algorithms"] -edition = "2018" +edition = "2021" +rust-version = "1.61" [features] serde1 = ["serde"] diff --git a/rand_xoshiro/README.md b/rand_xoshiro/README.md index 219ddafb..e3b792b4 100644 --- a/rand_xoshiro/README.md +++ b/rand_xoshiro/README.md @@ -5,7 +5,6 @@ [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_xoshiro) [![API](https://docs.rs/rand_xoshiro/badge.svg)](https://docs.rs/rand_xoshiro) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.36+-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements) Rust implementation of the [xoshiro, xoroshiro and splitmix64](http://xoshiro.di.unimi.it) random number generators.