end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

64bit整数等の巨大な数の乱数発生は、Math::BigInt::Random for perl

http://search.cpan.org/perldoc?Math%3A%3ABigInt%3A%3ARandom ↓こうかな?

#!/usr/local/bin/perl
use strict;
use Math::BigInt;
use Math::BigInt::Random;
use Data::Dumper;

main();

sub main {
    my $max = 18_446_744_073_709_551_615;

    my $i = 0;
    while( $i++ < 10 ){
        print Math::BigInt::Random::random_bigint( max => $max ),"\n";
    }
}
$ ./test.pl 
9506841540604143609
17290575413746988769
12642088427333715816
3437943406824129695
4510757347866451250
4637770013828130871
6569924293883749620
11166561186182411725
3618737948898655722
4641358188649576606