hmm... this seem to generate the same number over and over : $n = 1000 $sd = Math::BigInt->new(2)->bpow($n)->bsqrt->bdiv(2) $mean = Math::BigInt->new(2)->bpow($n)->bdiv(2) > p $sd * Math::BigInt->new(grandom(1)->at(0)) + $mean
On Tue, Nov 12, 2013 at 3:10 PM, mraptor <[email protected]> wrote: > thanks... my mistake with the byte thing.. > What I want to do is to generate normally distributed random numbers, > where the range is humongous (fe: 2^1000) > I just tried : >>$n = 1000 >> p grandom(3) * ((2**$n)/2) + sqrt((2**$n))/2 > [-1.9906798e+300 -3.9087665e+300 -5.6272303e+300] > > > those seem like a random numbers !! but why negative ? > Do you think I should use Math::BigInt > > On Mon, Nov 11, 2013 at 11:55 AM, Craig DeForest > <[email protected]> wrote: >> The issue is that grandom doesn't work properly on integer types, since it >> makes a distribution with mean 0 and stddev 1. It's a bit awkward, but you >> can use >> >> $vals = (grandom($n) * $stdev + $mean)->rint->byte >> >> instead. >> >> >> On Nov 11, 2013, at 8:59 AM, mraptor <[email protected]> wrote: >> >>> Is there are way to generate random values based on Normal distribution. >>> The same like rnorm() in R-language. >>> >>>> round( rnorm(3,mean=2^n/2,sd=sqrt(2^n)/2) ) >>> [1] 524758 524540 524647 >>> >>> I see there is grandom() funtion, but it requires some sort of lib (ndtri) ? >>> >>> pdl> p grandom(byte,1) >>> >>> ndtri domain error >>> [0] >>> >>> >>> thanks >>> >>> _______________________________________________ >>> Perldl mailing list >>> [email protected] >>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >>> >> _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
