Skip to content

Commit 2457cdb

Browse files
authored
Merge pull request #632 from dhardy/merge-small-rngs
Merge small rngs code
2 parents e9e607c + b3e7a01 commit 2457cdb

21 files changed

+1036
-290
lines changed

.travis.yml

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,64 +51,51 @@ sudo: false
5151
# - run benchmarks as tests:
5252
# `cargo test --benches --features=nightly`
5353
# Tests on subcrates:
54-
# `cargo test --package rand_core`
55-
# `cargo test --package rand_core --features=alloc` (requires nightly)
56-
# `cargo test --package rand_core --no-default-features`
57-
# `cargo test --package rand_isaac --features=serde1`
58-
# `cargo test --package rand_xorshift --features=serde1`
59-
# `cargo test --package rand_chacha`
60-
# `cargo test --package rand_hc128`
54+
# - select crates via --manifest-path (more reliable than --package)
55+
# - test appropriate feature matrix
6156
#
6257
# TODO: SIMD support on stable releases
6358
# NOTE: SIMD support is unreliable on nightly; we track the latest release
6459
matrix:
6560
include:
6661
- rust: 1.22.0
6762
env: DESCRIPTION="pinned stable Rust release"
68-
install:
6963
script:
64+
# Differs from standard script: rand_pcg features
7065
- cargo test --lib --no-default-features
66+
# TODO: add simd_support feature:
7167
- cargo test --features=serde1,log
7268
- cargo test --examples
73-
- cargo test --package rand_core
74-
- cargo test --package rand_core --no-default-features
75-
- cargo test --package rand_isaac --features=serde1
76-
# - cargo test --package rand_xorshift --features=serde1
77-
- cargo test --package rand_chacha
78-
- cargo test --package rand_hc128
69+
- cargo test --manifest-path rand_core/Cargo.toml
70+
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
71+
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
72+
# TODO: cannot test rand_pcg due to explicit dependency on i128
73+
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
74+
- cargo test --manifest-path rand_chacha/Cargo.toml
75+
- cargo test --manifest-path rand_hc128/Cargo.toml
7976

8077
- rust: stable
8178
env: DESCRIPTION="stable Rust release, macOS, iOS (cross-compile only)"
8279
os: osx
8380
install:
8481
- rustup target add aarch64-apple-ios
8582
script:
83+
# Differs from standard script: includes aarch64-apple-ios cross-build
8684
- cargo test --lib --no-default-features
8785
# TODO: add simd_support feature:
8886
- cargo test --features=serde1,log
8987
- cargo test --examples
90-
- cargo test --package rand_core
91-
- cargo test --package rand_core --no-default-features
92-
- cargo test --package rand_isaac --features=serde1
93-
- cargo test --package rand_xorshift --features=serde1
94-
- cargo test --package rand_chacha
95-
- cargo test --package rand_hc128
88+
- cargo test --manifest-path rand_core/Cargo.toml
89+
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
90+
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
91+
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
92+
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
93+
- cargo test --manifest-path rand_chacha/Cargo.toml
94+
- cargo test --manifest-path rand_hc128/Cargo.toml
9695
- cargo build --target=aarch64-apple-ios
9796

9897
- rust: beta
9998
env: DESCRIPTION="beta Rust release"
100-
install:
101-
script:
102-
- cargo test --lib --no-default-features
103-
# TODO: add simd_support feature:
104-
- cargo test --features=serde1,log
105-
- cargo test --examples
106-
- cargo test --package rand_core
107-
- cargo test --package rand_core --no-default-features
108-
- cargo test --package rand_isaac --features=serde1
109-
- cargo test --package rand_xorshift --features=serde1
110-
- cargo test --package rand_chacha
111-
- cargo test --package rand_hc128
11299

113100
- rust: nightly
114101
env: DESCRIPTION="nightly features, benchmarks, documentation"
@@ -118,16 +105,18 @@ matrix:
118105
before_script:
119106
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
120107
script:
108+
# Differs from standard script: alloc feature, all features, doc build
121109
- cargo test --lib --no-default-features --features=alloc
122110
- cargo test --all-features
123111
- cargo test --benches --features=nightly
124112
- cargo test --examples
125-
- cargo test --package rand_core
126-
- cargo test --package rand_core --no-default-features --features=alloc
127-
- cargo test --package rand_isaac --features=serde1
128-
# - cargo test --package rand_xorshift --features=serde1
129-
- cargo test --package rand_chacha
130-
- cargo test --package rand_hc128
113+
- cargo test --manifest-path rand_core/Cargo.toml
114+
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
115+
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
116+
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
117+
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
118+
- cargo test --manifest-path rand_chacha/Cargo.toml
119+
- cargo test --manifest-path rand_hc128/Cargo.toml
131120
# remove cached documentation, otherwise files from previous PRs can get included
132121
- rm -rf target/doc
133122
- cargo doc --no-deps --all --all-features
@@ -179,22 +168,38 @@ matrix:
179168
dist: trusty
180169
services: docker
181170
env: DESCRIPTION="Linux (MIPS, big-endian)" TARGET=mips-unknown-linux-gnu
171+
install:
172+
- sh utils/ci/install.sh
173+
- source ~/.cargo/env || true
174+
script:
175+
- bash utils/ci/script.sh
182176
- rust: stable
183177
sudo: required
184178
dist: trusty
185179
services: docker
186180
env: DESCRIPTION="Android (ARMv7)" TARGET=armv7-linux-androideabi
181+
install:
182+
- sh utils/ci/install.sh
183+
- source ~/.cargo/env || true
184+
script:
185+
- bash utils/ci/script.sh
187186

188187
before_install:
189188
- set -e
190189
- rustup self update
191190

192-
# Used by all Trust targets; others must override:
193-
install:
194-
- sh utils/ci/install.sh
195-
- source ~/.cargo/env || true
196191
script:
197-
- bash utils/ci/script.sh
192+
- cargo test --lib --no-default-features
193+
# TODO: add simd_support feature:
194+
- cargo test --features=serde1,log
195+
- cargo test --examples
196+
- cargo test --manifest-path rand_core/Cargo.toml
197+
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
198+
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
199+
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
200+
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
201+
- cargo test --manifest-path rand_chacha/Cargo.toml
202+
- cargo test --manifest-path rand_hc128/Cargo.toml
198203

199204
after_script: set +e
200205

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ simd_support = ["packed_simd"] # enables SIMD support
2828
serde1 = ["rand_core/serde1", "rand_isaac/serde1", "rand_xorshift/serde1"] # enables serialization for PRNGs
2929

3030
[workspace]
31-
members = ["rand_core", "rand_isaac", "rand_chacha", "rand_hc128", "rand_xorshift"]
31+
members = ["rand_core", "rand_isaac", "rand_chacha", "rand_hc128", "rand_pcg", "rand_xorshift"]
3232

3333
[dependencies]
3434
rand_core = { path = "rand_core", version = "0.3", default-features = false }

appveyor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,10 @@ test_script:
4343
- cargo test --package rand_xorshift --features=serde1
4444
- cargo test --package rand_chacha
4545
- cargo test --package rand_hc128
46+
- cargo test --manifest-path rand_core/Cargo.toml
47+
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
48+
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
49+
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
50+
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
51+
- cargo test --manifest-path rand_chacha/Cargo.toml
52+
- cargo test --manifest-path rand_hc128/Cargo.toml

rand_pcg/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [0.1.1] - 2018-10-04
8+
- make `bincode` an explicit dependency when using Serde
9+
10+
## [0.1.0] - 2018-10-04
11+
Initial release, including:
12+
13+
- `Lcg64Xsh32` aka `Pcg32`
14+
- `Mcg128Xsl64` aka `Pcg64Mcg`

rand_pcg/COPYRIGHT

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Copyrights in the Rand project are retained by their contributors. No
2+
copyright assignment is required to contribute to the Rand project.
3+
4+
For full authorship information, see the version control history.
5+
6+
Except as otherwise noted (below and/or in individual files), Rand is
7+
licensed under the Apache License, Version 2.0 <LICENSE-APACHE> or
8+
<http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
<LICENSE-MIT> or <http://opensource.org/licenses/MIT>, at your option.
10+
11+
The Rand project includes code from the Rust project
12+
published under these same licenses.

rand_pcg/Cargo.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[package]
2+
name = "rand_pcg"
3+
version = "0.1.1" # NB: When modifying, also modify html_root_url in lib.rs
4+
authors = ["The Rand Project Developers"]
5+
license = "MIT/Apache-2.0"
6+
readme = "README.md"
7+
repository = "https://github.com/rust-random/rand"
8+
documentation = "https://docs.rs/rand_pcg"
9+
homepage = "https://crates.io/crates/rand_pcg"
10+
description = """
11+
Selected PCG random number generators
12+
"""
13+
keywords = ["random", "rng", "pcg"]
14+
categories = ["algorithms", "no-std"]
15+
build = "build.rs"
16+
17+
[badges]
18+
travis-ci = { repository = "rust-random/rand" }
19+
appveyor = { repository = "rust-random/rand" }
20+
21+
[features]
22+
serde1 = ["serde", "serde_derive"]
23+
24+
[dependencies]
25+
rand_core = { path = "../rand_core", version = "0.3", default-features=false }
26+
serde = { version = "1", optional = true }
27+
serde_derive = { version = "^1.0.38", optional = true }
28+
29+
[dev-dependencies]
30+
# This is for testing serde, unfortunately we can't specify feature-gated dev
31+
# deps yet, see: https://github.com/rust-lang/cargo/issues/1596
32+
# TODO: we shouldn't have to depend on i128 directly; it breaks tests on old
33+
# compilers. `bincode` should automatically support this.
34+
bincode = { version = "1", features = ["i128"] }
35+
36+
[build-dependencies]
37+
rustc_version = "0.2"

0 commit comments

Comments
 (0)