[−][src]Function solana_rbpf::helpers::rand
pub fn rand(min: u64, max: u64, unused3: u64, unused4: u64, unused5: u64) -> u64
Returns a random u64 value comprised between min
and max
values (inclusive). Arguments 3 to
5 are unused.
Relies on rand()
function from libc, so libc::srand()
should be called once before this
helper is used.
Examples
extern crate libc; extern crate solana_rbpf; extern crate time; unsafe { libc::srand(time::precise_time_ns() as u32) } let n = solana_rbpf::helpers::rand(3, 6, 0, 0, 0); assert!(3 <= n && n <= 6);