我正在使用 perl 的 Crypt::Random 模块生成随机数,该模块依赖于 Math::Pari,Pari/GP 的 perl 接口,并在尝试生成 1.5M 数字时出现此错误:
C:\Users\Jlinne\Documents>perl -MCrypt::Random=makerandom_itv -E "say makerandom_itv(Lower => '10^1499999', Upper => '10^1500000')" > num_1500000.txt
PARI: *** the PARI stack overflows !
current stack size: 4.0 Mbytes
[hint] you can increase GP stack with allocatemem()
C:\Users\Ryan\Documents\Perl Scripts>perl scripts1.pl
"use" not allowed in expression at scripts1.pl line 6, at end of line
syntax error at scripts1.pl line 6, near "use Math::Pari
use Math::PariInit "
BEGIN not safe after errors--compilation aborted at scripts1.pl line 7.
我的脚本:
#!/usr/bin/env perl
use warnings;
use strict;
use feature 'say';
use Math::Pari
use Math::PariInit qw( primes=12000000 stack=1e8 );
use Crypt::Random
我猜想 allocatemem() 函数是 Math::Pari 函数,但事实并非如此。与单行相比,有谁知道使用脚本将 GP 堆栈大小更改为 8.0 MB?谢谢。
堆栈到 1e+32 的问题
C:\Users\Jlinne\Documents\Perl Scripts>perl scripts1.pl > BIGINT1500000.txt
PARI: *** the PARI stack overflows !
current stack size: 0.0 Mbytes
[hint] you can increase GP stack with allocatemem()
Compilation failed in require at C:/Strawberry/perl/site/lib/Math/PariInit.pm line 26.
BEGIN failed--compilation aborted at scripts1.pl line 6.
脚本:
use warnings 'all';
use strict;
use feature 'say';
# use Math::Pari;
use Math::PariInit qw( stack=1e32 );
use Crypt::Random qw(makerandom_itv);
say makerandom_itv(Lower => '10^1499999', Upper => '10^1500000');