Skip to content

Commit 5454539

Browse files
authored
Merge pull request #802 from vks/xoshiro-release
Prepare rand_xoshiro for 0.2 release
2 parents 7f56d4e + b3c2757 commit 5454539

16 files changed

+117
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ libc = { version = "0.2.22", default-features = false }
6666

6767
[dev-dependencies]
6868
# Only for benches:
69-
rand_xoshiro = { path = "rand_xoshiro", version = "0.1" }
69+
rand_xoshiro = { path = "rand_xoshiro", version = "0.2" }
7070
rand_isaac = { path = "rand_isaac", version = "0.1" }
7171
rand_chacha = { path = "rand_chacha", version = "0.2" }
7272
rand_xorshift = { path = "rand_xorshift", version = "0.1" }

rand_xoshiro/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.2.0] - 2019-05-28
8+
- Fix `seed_from_u64(0)` for `Xoroshiro64StarStar` and `Xoroshiro64Star`. This
9+
breaks value stability for these generators if initialized with `seed_from_u64`.
10+
- Implement Serde support.
11+
712
## [0.1.0] - 2019-01-04
813
Initial release.

rand_xoshiro/Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_xoshiro"
3-
version = "0.1.0" # NB: When modifying, also modify html_root_url in lib.rs
3+
version = "0.2.0" # NB: When modifying, also modify html_root_url in lib.rs
44
authors = ["The Rand Project Developers"]
55
license = "MIT/Apache-2.0"
66
readme = "README.md"
@@ -11,9 +11,17 @@ description = "Xoshiro, xoroshiro and splitmix64 random number generators"
1111
keywords = ["random", "rng"]
1212
categories = ["algorithms"]
1313

14+
[features]
15+
serde1 = ["serde", "serde_derive"]
16+
1417
[dependencies]
1518
byteorder = { version = "1", default-features=false }
1619
rand_core = { path = "../rand_core", version = "0.4" }
20+
serde = { version = "1", optional=true }
21+
serde_derive = { version = "^1.0.38", optional=true }
1722

1823
[dev-dependencies]
1924
rand = { path = "..", version = "0.6", default-features=false } # needed for doctests
25+
# This is for testing serde, unfortunately we can't specify feature-gated dev
26+
# deps yet, see: https://github.com/rust-lang/cargo/issues/1596
27+
bincode = { version = "1" }

rand_xoshiro/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,16 @@
5858
5959
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
6060
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
61-
html_root_url = "https://docs.rs/rand_xoshiro/0.1.0")]
61+
html_root_url = "https://docs.rs/rand_xoshiro/0.2.0")]
6262

6363
#![deny(missing_docs)]
6464
#![deny(missing_debug_implementations)]
6565
#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
6666
#![no_std]
6767
extern crate byteorder;
6868
pub extern crate rand_core;
69+
#[cfg(feature="serde1")] extern crate serde;
70+
#[cfg(feature="serde1")] #[macro_use] extern crate serde_derive;
6971

7072
#[macro_use]
7173
mod common;

rand_xoshiro/src/splitmix64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use rand_core::{RngCore, SeedableRng, Error};
2222
/// from [`dsiutils`](http://dsiutils.di.unimi.it/) is used.
2323
#[allow(missing_copy_implementations)]
2424
#[derive(Debug, Clone)]
25+
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
2526
pub struct SplitMix64 {
2627
x: u64,
2728
}

rand_xoshiro/src/xoroshiro128plus.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use rand_core::{RngCore, SeedableRng};
2222
/// David Blackman and Sebastiano Vigna.
2323
#[allow(missing_copy_implementations)]
2424
#[derive(Debug, Clone)]
25+
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
2526
pub struct Xoroshiro128Plus {
2627
s0: u64,
2728
s1: u64,

rand_xoshiro/src/xoroshiro128starstar.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use rand_core::{RngCore, SeedableRng};
2121
/// David Blackman and Sebastiano Vigna.
2222
#[allow(missing_copy_implementations)]
2323
#[derive(Debug, Clone)]
24+
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
2425
pub struct Xoroshiro128StarStar {
2526
s0: u64,
2627
s1: u64,

rand_xoshiro/src/xoroshiro64star.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use rand_core::{RngCore, SeedableRng};
2222
/// David Blackman and Sebastiano Vigna.
2323
#[allow(missing_copy_implementations)]
2424
#[derive(Debug, Clone)]
25+
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
2526
pub struct Xoroshiro64Star {
2627
s0: u32,
2728
s1: u32,

rand_xoshiro/src/xoroshiro64starstar.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rand_core::le::read_u32_into;
1111
use rand_core::impls::{fill_bytes_via_next, next_u64_via_u32};
1212
use rand_core::{RngCore, SeedableRng};
1313

14-
/// A Xoroshiro64** random number generator.
14+
/// A xoroshiro64** random number generator.
1515
///
1616
/// The xoshiro64** algorithm is not suitable for cryptographic purposes, but
1717
/// is very fast and has excellent statistical properties.
@@ -21,6 +21,7 @@ use rand_core::{RngCore, SeedableRng};
2121
/// David Blackman and Sebastiano Vigna.
2222
#[allow(missing_copy_implementations)]
2323
#[derive(Debug, Clone)]
24+
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
2425
pub struct Xoroshiro64StarStar {
2526
s0: u32,
2627
s1: u32,

rand_xoshiro/src/xoshiro128plus.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use rand_core::{SeedableRng, RngCore, Error};
2020
/// reference source code](http://xoshiro.di.unimi.it/xoshiro128starstar.c) by
2121
/// David Blackman and Sebastiano Vigna.
2222
#[derive(Debug, Clone)]
23+
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
2324
pub struct Xoshiro128Plus {
2425
s: [u32; 4],
2526
}

0 commit comments

Comments
 (0)