Guest User

Untitled

a guest
Jan 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. extern crate rand_core;
  2. extern crate rand_pcg;
  3. #[macro_use]
  4. extern crate lazy_static;
  5.  
  6. use rand_pcg::Pcg32 as Rng;
  7. use rand_core::{SeedableRng, RngCore};
  8. use std::sync::Mutex;
  9.  
  10. lazy_static! {
  11. static ref rng: Mutex<Rng> = Mutex::new(Rng::seed_from_u64(0));
  12. }
  13.  
  14. #[no_mangle]
  15. pub extern fn call_pcg32() -> u32 {
  16. rng.lock().unwrap().next_u32()
  17. }
Add Comment
Please, Sign In to add comment