#![allow(unknown_lints)] #![allow(unreadable_literal)] extern crate rand; extern crate xoroshiro; use rand::{Rng, RngCore}; use xoroshiro::rng::{XoroShiro128, XorShift1024}; #[test] fn xoroshiro128_sm64_seed() { let seed: u64 = 1477780064718404645; let expected: Vec = vec![ 161743971435277218, 12749638389516825946, 4146736784021417053, 11394733814739543922, 5919433169786178858, 4241863456358946179, 7153495629702943020, 6615420010493371247, 9952100663899464852, 14672847684171515009, 17113800272934008423, 16403311139858716934, 12215484346000886377, 14238806683115497214, 13910142693410592070, 7724144857223886361, 9075733398169617904, 5634930714536464900, 2733942052901160118, 17693715793714424022, 8137122508671055182, 6415747618330055320, 15705975534504365925, 5868048410449252447, 9108959133630137736, 7483243276722213562, 14868796904872558029, 6313023836281617677, 6649336199478439294, 16149102996888215516, 3727991758618490683, 2320694756706062361, 12162126961292846971, 15484054774226706687, 16851698291513424180, 6211763121824466039, 1443411643584089856, 11814931554953919683, 1229846429463909320, 834914031011571225, 13014431014741371058, 5432524950931051905, 8352162180100044457, 4423136763541234055, 12211563008565317702, 10719456616463860877, 2097044165121537405, 10275641484510235258, 1951146658863428296, 9961210433054140615 ]; let mut rng = XoroShiro128::from_seed_u64(seed); for (i, &j) in rng.gen_iter::().zip(expected.iter()) { assert_eq!(i, j); } } #[test] fn xorshift1024_sm64_seed() { let seed: u64 = 1477780182365762752; let expected: Vec = vec![ 620952640393567647, 4424703035553004480, 11378483887141380912, 12909309838530000575, 15510412634479241846, 4698881427858152138, 9973856618087989458, 1216260276964432923, 10516282693839818343, 9373024415013443192, 14940748190932167555, 9463863620907134364, 7053620806449951210, 4731159705264626600, 3533971980364118858, 12869703139335272879, 16891800553881512896, 17722876862396860997, 1160436685971833676, 11713443815500047557, 17785895831995004020, 4250830786845494940, 17109290541754447335, 10130233172552049810, 5665776461498745574, 3559151331529708137, 58406752107747254, 10342559824080000828, 12997140981739688083, 15124671432650849703, 15661163374090509477, 10054051941501250826, 6672584075212103186, 772442644767211310, 1877225067521791115, 8070244231422884197, 3263131939296129293, 4741036171793518647, 17649550806185467323, 17368185410307485445, 1370722928978240690, 9083765346353644815, 5756864993298480798, 18210075554277000302, 4831360753065420189, 5223424238662334870, 18256859201088947638, 10289779728715187205, 4605294917890610279, 5995275849294465096, ]; let mut rng = XorShift1024::from_seed_u64(seed); for (i, &j) in rng.gen_iter::().zip(expected.iter()) { assert_eq!(i, j); } } #[test] fn xoroshiro128_sm64_seed_jumps() { let seed: u64 = 1477780685585184119; let mut rng = xoroshiro::rng::SplitMix64::from_seed_u64(seed); for _ in 0..2 { println!("{}ul,", rng.next_u64()); } let expected: Vec = vec![ 7363123556067731325, 11743806326703499081, 11017078471850861282, 6537481313430306491, 1734032112987717604, 5180571021312121954, 3442966274224547762, 4094090387771775361, 18054519279123885422, 14557847324980967237, 6042207721959556892, 16758864894686705829, 11096095272679097818, 880786699494201485, 15328614793127720471, 13892737921325360346, 8325147650871463291, 3991156015381259310, 18068907175194483049, 15416978590692154546, 6957056196276506653, 15485008903412937461, 13150412147600451329, 6145842285392582846, 16515019917555447020, 256586483171449133, 2718459902581448649, 7091617294121361198, 15206544481892958765, 1270439699417559690, 1319940446266325114, 6237439622392080613, 5207717649918826118, 84863475645399540, 1345811548000146967, 14567228697863434988, 8287116353595203179, 2107959157140947859, 12171276951494883762, 9800690783379362250, 5826182796358441966, 351365107720279578, 3763752402021015792, 4377946622975149565, 17065932569806129746, 2246497116407309970, 5850190023311132789, 13588387146044389660, 8821738610530612520, 5335768027764772758, ]; let mut rng = XoroShiro128::from_seed_u64(seed); for _ in 0..10 { rng.jump(); } for (i, &j) in rng.gen_iter::().zip(expected.iter()) { assert_eq!(i, j); } } #[test] fn xorshift1024_sm64_seed_jumps() { let seed: u64 = 1477780352127933297; let expected: Vec = vec![ 12158041363794534462, 16000537750697378032, 2205806554144492496, 16934579345167371492, 6957043221322491931, 8314361534940610811, 4985908528780665048, 12522663486048696114, 9898537096683596583, 1770735028224399527, 2750828709454839112, 328414695426035224, 8666045873315740527, 16334200602440547554, 13386539297715135445, 3242348031061362480, 10770270831449999267, 17955464863164629977, 895957009472000179, 2345331535431208160, 936630434388735998, 14371593808524511452, 16862773227901128084, 15456111821768593165, 2764401198941173393, 15630524699556797871, 14751986152562794221, 9514655284276756098, 7364399827328589681, 13585323801284208884, 2548019376476236068, 15994563962358553454, 2576158154942974850, 10924194596592353982, 7691235499970679846, 1319920943298667762, 10583217387313089930, 12688206357627267649, 8102615013793002638, 12514269253467497737, 8191964583512472568, 10883911767981167843, 2702878957258810423, 17876591333428129652, 3687514060076289566, 13483258580227684050, 15034661148732294524, 17088221277098291622, 11196404818485544576, 5960192554190587011, ]; let mut rng = XorShift1024::from_seed_u64(seed); for _ in 0..10 { rng.jump(); } for (i, &j) in rng.gen_iter::().zip(expected.iter()) { assert_eq!(i, j); } }