NLinker icon

Initialize XorShiftRng and IsaacRng with seed

NLinker | PRO | 07/13/18 05:55:22 AM UTC | 0 ⭐ | 976 👁️ | Never ⏰ | []
Rust |

490 B

|

None

|

0 👍

/

0 👎

extern crate rand;
extern crate byteorder;
 
use byteorder::{ByteOrder, LittleEndian as LE};
use rand::{IsaacRng, XorShiftRng};
 
fn main() {
    let mut buf = [0; 16];
    {
        let (mut b1, mut b2) = buf.split_at_mut(8);
        byteorder::LittleEndian::write_u64(&mut b1, 123);
        byteorder::LittleEndian::write_u64(&mut b2, 123);
    }
    let random = Rc::new(RefCell::new(XorShiftRng::from_seed(buf)));
    let random = Rc::new(RefCell::new(IsaacRng::new_from_u64(123)));
}

Comments