Skip to content

Commit 8255494

Browse files
authored
Merge pull request #668 from ischeinkman/master
Made rand_xoshiro #![no_std].
2 parents afd29d0 + 003bba2 commit 8255494

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

rand_xoshiro/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords = ["random", "rng"]
1212
categories = ["algorithms"]
1313

1414
[dependencies]
15-
byteorder = "1"
15+
byteorder = { version = "1", default-features=false }
1616
rand_core = { path = "../rand_core", version = "0.3", default-features=false }
1717

1818
[dev-dependencies]

rand_xoshiro/src/common.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,16 @@ macro_rules! deal_with_zero_seed {
207207
#[derive(Clone)]
208208
pub struct Seed512(pub [u8; 64]);
209209

210+
use core;
210211
impl Seed512 {
211212
/// Return an iterator over the seed.
212-
pub fn iter(&self) -> ::std::slice::Iter<u8> {
213+
pub fn iter(&self) -> core::slice::Iter<u8> {
213214
self.0.iter()
214215
}
215216
}
216217

217-
impl ::std::fmt::Debug for Seed512 {
218-
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
218+
impl core::fmt::Debug for Seed512 {
219+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
219220
self.0[..].fmt(f)
220221
}
221222
}

rand_xoshiro/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
#![deny(missing_docs)]
6767
#![deny(missing_debug_implementations)]
6868
#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
69-
69+
#![no_std]
7070
extern crate byteorder;
7171
extern crate rand_core;
7272

rand_xoshiro/src/splitmix64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ mod tests {
8484
let mut rng = SplitMix64::seed_from_u64(1477776061723855037);
8585
// These values were produced with the reference implementation:
8686
// http://xoshiro.di.unimi.it/splitmix64.c
87-
let expected = vec![
87+
let expected : [u64 ; 50]= [
8888
1985237415132408290, 2979275885539914483, 13511426838097143398,
8989
8488337342461049707, 15141737807933549159, 17093170987380407015,
9090
16389528042912955399, 13177319091862933652, 10841969400225389492,
@@ -103,7 +103,7 @@ mod tests {
103103
9420238805069527062, 10338115333623340156, 13514802760105037173,
104104
14635952304031724449, 15419692541594102413,
105105
];
106-
for &e in &expected {
106+
for &e in expected.iter() {
107107
assert_eq!(rng.next_u64(), e);
108108
}
109109
}
@@ -113,7 +113,7 @@ mod tests {
113113
let mut rng = SplitMix64::seed_from_u64(10);
114114
// These values were produced with the reference implementation:
115115
// http://dsiutils.di.unimi.it/dsiutils-2.5.1-src.tar.gz
116-
let expected = vec![
116+
let expected : [u32 ; 100]= [
117117
3930361779, 4016923089, 4113052479, 925926767, 1755287528,
118118
802865554, 954171070, 3724185978, 173676273, 1414488795, 12664133,
119119
1784889697, 1303817078, 261610523, 941280008, 2571813643,
@@ -135,7 +135,7 @@ mod tests {
135135
1039141475, 3984640460, 4142959054, 2252788890, 2459379590,
136136
991872507,
137137
];
138-
for &e in &expected {
138+
for &e in expected.iter() {
139139
assert_eq!(rng.next_u32(), e);
140140
}
141141
}

0 commit comments

Comments
 (0)