Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge small rngs code #632

Merged
merged 4 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 48 additions & 43 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,64 +51,51 @@ sudo: false
# - run benchmarks as tests:
# `cargo test --benches --features=nightly`
# Tests on subcrates:
# `cargo test --package rand_core`
# `cargo test --package rand_core --features=alloc` (requires nightly)
# `cargo test --package rand_core --no-default-features`
# `cargo test --package rand_isaac --features=serde1`
# `cargo test --package rand_xorshift --features=serde1`
# `cargo test --package rand_chacha`
# `cargo test --package rand_hc128`
# - select crates via --manifest-path (more reliable than --package)
# - test appropriate feature matrix
#
# TODO: SIMD support on stable releases
# NOTE: SIMD support is unreliable on nightly; we track the latest release
matrix:
include:
- rust: 1.22.0
env: DESCRIPTION="pinned stable Rust release"
install:
script:
# Differs from standard script: rand_pcg features
- cargo test --lib --no-default-features
# TODO: add simd_support feature:
- cargo test --features=serde1,log
- cargo test --examples
- cargo test --package rand_core
- cargo test --package rand_core --no-default-features
- cargo test --package rand_isaac --features=serde1
# - cargo test --package rand_xorshift --features=serde1
- cargo test --package rand_chacha
- cargo test --package rand_hc128
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
# TODO: cannot test rand_pcg due to explicit dependency on i128
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc128/Cargo.toml

- rust: stable
env: DESCRIPTION="stable Rust release, macOS, iOS (cross-compile only)"
os: osx
install:
- rustup target add aarch64-apple-ios
script:
# Differs from standard script: includes aarch64-apple-ios cross-build
- cargo test --lib --no-default-features
# TODO: add simd_support feature:
- cargo test --features=serde1,log
- cargo test --examples
- cargo test --package rand_core
- cargo test --package rand_core --no-default-features
- cargo test --package rand_isaac --features=serde1
- cargo test --package rand_xorshift --features=serde1
- cargo test --package rand_chacha
- cargo test --package rand_hc128
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc128/Cargo.toml
- cargo build --target=aarch64-apple-ios

- rust: beta
env: DESCRIPTION="beta Rust release"
install:
script:
- cargo test --lib --no-default-features
# TODO: add simd_support feature:
- cargo test --features=serde1,log
- cargo test --examples
- cargo test --package rand_core
- cargo test --package rand_core --no-default-features
- cargo test --package rand_isaac --features=serde1
- cargo test --package rand_xorshift --features=serde1
- cargo test --package rand_chacha
- cargo test --package rand_hc128

- rust: nightly
env: DESCRIPTION="nightly features, benchmarks, documentation"
Expand All @@ -118,16 +105,18 @@ matrix:
before_script:
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
script:
# Differs from standard script: alloc feature, all features, doc build
- cargo test --lib --no-default-features --features=alloc
- cargo test --all-features
- cargo test --benches --features=nightly
- cargo test --examples
- cargo test --package rand_core
- cargo test --package rand_core --no-default-features --features=alloc
- cargo test --package rand_isaac --features=serde1
# - cargo test --package rand_xorshift --features=serde1
- cargo test --package rand_chacha
- cargo test --package rand_hc128
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc128/Cargo.toml
# remove cached documentation, otherwise files from previous PRs can get included
- rm -rf target/doc
- cargo doc --no-deps --all --all-features
Expand Down Expand Up @@ -179,22 +168,38 @@ matrix:
dist: trusty
services: docker
env: DESCRIPTION="Linux (MIPS, big-endian)" TARGET=mips-unknown-linux-gnu
install:
- sh utils/ci/install.sh
- source ~/.cargo/env || true
script:
- bash utils/ci/script.sh
- rust: stable
sudo: required
dist: trusty
services: docker
env: DESCRIPTION="Android (ARMv7)" TARGET=armv7-linux-androideabi
install:
- sh utils/ci/install.sh
- source ~/.cargo/env || true
script:
- bash utils/ci/script.sh

before_install:
- set -e
- rustup self update

# Used by all Trust targets; others must override:
install:
- sh utils/ci/install.sh
- source ~/.cargo/env || true
script:
- bash utils/ci/script.sh
- cargo test --lib --no-default-features
# TODO: add simd_support feature:
- cargo test --features=serde1,log
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc128/Cargo.toml

after_script: set +e

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ simd_support = ["packed_simd"] # enables SIMD support
serde1 = ["rand_core/serde1", "rand_isaac/serde1", "rand_xorshift/serde1"] # enables serialization for PRNGs

[workspace]
members = ["rand_core", "rand_isaac", "rand_chacha", "rand_hc128", "rand_xorshift"]
members = ["rand_core", "rand_isaac", "rand_chacha", "rand_hc128", "rand_pcg", "rand_xorshift"]

[dependencies]
rand_core = { path = "rand_core", version = "0.3", default-features = false }
Expand Down
7 changes: 7 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ test_script:
- cargo test --package rand_xorshift --features=serde1
- cargo test --package rand_chacha
- cargo test --package rand_hc128
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc128/Cargo.toml
14 changes: 14 additions & 0 deletions rand_pcg/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.1] - 2018-10-04
- make `bincode` an explicit dependency when using Serde

## [0.1.0] - 2018-10-04
Initial release, including:

- `Lcg64Xsh32` aka `Pcg32`
- `Mcg128Xsl64` aka `Pcg64Mcg`
12 changes: 12 additions & 0 deletions rand_pcg/COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyrights in the Rand project are retained by their contributors. No
copyright assignment is required to contribute to the Rand project.

For full authorship information, see the version control history.

Except as otherwise noted (below and/or in individual files), Rand is
licensed under the Apache License, Version 2.0 <LICENSE-APACHE> or
<http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
<LICENSE-MIT> or <http://opensource.org/licenses/MIT>, at your option.

The Rand project includes code from the Rust project
published under these same licenses.
37 changes: 37 additions & 0 deletions rand_pcg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "rand_pcg"
version = "0.1.1" # NB: When modifying, also modify html_root_url in lib.rs
authors = ["The Rand Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-random/rand"
documentation = "https://docs.rs/rand_pcg"
homepage = "https://crates.io/crates/rand_pcg"
description = """
Selected PCG random number generators
"""
keywords = ["random", "rng", "pcg"]
categories = ["algorithms", "no-std"]
build = "build.rs"

[badges]
travis-ci = { repository = "rust-random/rand" }
appveyor = { repository = "rust-random/rand" }

[features]
serde1 = ["serde", "serde_derive"]

[dependencies]
rand_core = { path = "../rand_core", version = "0.3", default-features=false }
serde = { version = "1", optional = true }
serde_derive = { version = "^1.0.38", optional = true }

[dev-dependencies]
# This is for testing serde, unfortunately we can't specify feature-gated dev
# deps yet, see: https://github.com/rust-lang/cargo/issues/1596
# TODO: we shouldn't have to depend on i128 directly; it breaks tests on old
# compilers. `bincode` should automatically support this.
bincode = { version = "1", features = ["i128"] }

[build-dependencies]
rustc_version = "0.2"
Loading