#[test]
fn bool() {
for x in &[false, true] { while fastrand::bool() != *x {}
}
}
#[test]
fn u8() {
for x in 0..10 { while fastrand::u8(..10) != x {}
}
for x in 200..=u8::MAX { while fastrand::u8(200..) != x {}
}
}
#[test]
fn i8() {
for x in -128..-120 { while fastrand::i8(..-120) != x {}
}
for x in 120..=127 { while fastrand::i8(120..) != x {}
}
}
#[test]
fn u32() {
for n in 1u32..10_000 { let n = n.wrapping_mul(n); let n = n.wrapping_mul(n); if n != 0 {
for _ in 0..1000 {
assert!(fastrand::u32(..n) < n);
}
}
}
}
#[test]
fn u64() {
for n in 1u64..10_000 { let n = n.wrapping_mul(n); let n = n.wrapping_mul(n); let n = n.wrapping_mul(n); if n != 0 {
for _ in 0..1000 {
assert!(fastrand::u64(..n) < n);
}
}
}
}
#[test]
fn u128() {
for n in 1u128..10_000 { let n = n.wrapping_mul(n); let n = n.wrapping_mul(n); let n = n.wrapping_mul(n); let n = n.wrapping_mul(n); if n != 0 {
for _ in 0..1000 {
assert!(fastrand::u128(..n) < n);
}
}
}
}
#[test]
fn fill() { letmut r = fastrand::Rng::new(); letmut a = [0u8; 64]; letmut b = [0u8; 64];
r.fill(&mut a);
r.fill(&mut b);
assert_ne!(a, b);
}
#[test]
fn rng() { letmut r = fastrand::Rng::new();
assert_ne!(r.u64(..), r.u64(..));
r.seed(7); let a = r.u64(..);
r.seed(7); let b = r.u64(..);
assert_eq!(a, b);
}
#[test]
fn rng_init() { letmut a = fastrand::Rng::new(); letmut b = fastrand::Rng::new();
assert_ne!(a.u64(..), b.u64(..));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.