Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: how to get a 64bit random number with rand() ?

by Anonymous Monk
on Mar 21, 2018 at 20:32 UTC ( [id://1211455]=note: print w/replies, xml ) Need Help??


in reply to how to get a 64bit random number with rand() ?

If you're on Linux and need a block of randomness of decent quality, you may defer to system's random generator. Tools like shuf use the same under the hood.

#! /usr/bin/perl use strict; use warnings; sub rnd_bytes { local $/ = \( shift || 8 ); open my $fh, '<', '/dev/urandom'; scalar <$fh> } for my $n (unpack "Q*", rnd_bytes(20 * 8)) { printf "\r%064b %016X\n",$n,$n; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1211455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-18 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found