RNG(3pm)

πŸ“¦
version 2.085 Β· 4 versions
, in ubuntu noble

πŸ’– RNG πŸ’–

okay bestie, sit down, hydrate, because this is PDL::GSL::RNG β€” the Perl Data Language's lil doorway into the random-number magic of the GNU Scientific Library, documented in the RNG(3pm) manual (User Contributed Perl Documentation, if we're being ✨official✨ about it).


🌸 NAME 🌸

PDL::GSL::RNG β€” a PDL interface to the RNG and randist routines in GSL. no cap.


πŸ¦‹ DESCRIPTION πŸ¦‹

So basically: this is an interface to the rng and randist packages that live inside the GNU Scientific Library. that's the whole vibe. she's a bridge. she's a connector. she's giving interoperability. πŸ’…


✨ SYNOPSIS ✨

here's the lil taste test, the trailer, the first 30 seconds of the pilot:

use PDL;
use PDL::GSL::RNG;

$rng = PDL::GSL::RNG->new('taus');

$rng->set_seed(time());

$x=zeroes(5,5,5)

$rng->get_uniform($x); # inplace

$y=$rng->get_uniform(3,4,5); # creates new pdl

see how she does it? $rng->get_uniform($x); fills the ndarray you already have in place (no new object, she just moves in 🏠), and $rng->get_uniform(3,4,5); creates a brand new pdl shaped 3,4,5. two moods, one method. iconic.


πŸŽ€ NOMENCLATURE πŸŽ€

okay so this part matters, bestie, don't skip it πŸ™ˆ

Everywhere in this doc, we try to use the same variable names that show up in the original GSL documentation (peep the See Also, it's right there). and a lot of the time, GSL calls those variables "a" and "b".

BUT β€” and this is the plot twist β€” good Perl coding practices say do not go around using the Perl variables $a and $b. so here we call Parameters "a" and "b" $pa and $pb respectively, and Limits (of domain or of integration) get called $la and $lb. periodt. πŸ’œ


πŸ‘‘ FUNCTIONS πŸ‘‘

🧚 new

The new method initializes a new instance of the RNG. she's born ✨

The available RNGs are:

 coveyou cmrg fishman18 fishman20 fishman2x gfsr4 knuthran
 knuthran2 knuthran2002 lecuyer21 minstd mrg mt19937 mt19937_1999
 mt19937_1998 r250 ran0 ran1 ran2 ran3 rand rand48 random128_bsd
 random128_glibc2 random128_libc5 random256_bsd random256_glibc2
 random256_libc5 random32_bsd random32_glibc2 random32_libc5
 random64_bsd random64_glibc2 random64_libc5 random8_bsd
 random8_glibc2 random8_libc5 random_bsd random_glibc2
 random_libc5 randu ranf ranlux ranlux389 ranlxd1 ranlxd2 ranlxs0
 ranlxs1 ranlxs2 ranmar slatec taus taus2 taus113 transputer tt800
 uni uni32 vax waterman14 zuf default

The last one (default) uses the environment variable GSL_RNG_TYPE.

⚠️ heads up bestie: only a few of these rngs are recommended for general use. please check the GSL documentation for more info β€” she said what she said πŸ’€

Usage:

$blessed_ref = PDL::GSL::RNG->new($RNG_name);

Example:

$rng = PDL::GSL::RNG->new('taus');

πŸ“ set_seed

Sets the RNG seed. give her a little origin story 🫢

Usage:

$rng->set_seed($integer);
# or
$rng = PDL::GSL::RNG->new('taus')->set_seed($integer);

Example:

$rng->set_seed(666);

🌈 min

Return the minimum value generable by this RNG. the floor. the basement. the lowest of the low. πŸ“‰

Usage:

$integer = $rng->min();

Example:

$min = $rng->min(); $max = $rng->max();

⭐ max

Return the maximum value generable by the RNG. the ceiling, the penthouse, the main character energy of numbers. πŸ“ˆ

Usage:

$integer = $rng->max();

Example:

$min = $rng->min(); $max = $rng->max();

πŸ¦‹ name

Returns the name of the RNG. she tells you who she is. self-aware queen πŸ‘‘

Usage:

$string = $rng->name();

Example:

$name = $rng->name();

πŸ’– get

This function either creates an ndarray with the dimensions you give it, or accepts an existing ndarray and fills it. get() returns integer values between a minimum and a maximum that's specific to every single RNG β€” like, every RNG has its own range, no two alike πŸ’…

Usage:

$ndarray = $rng->get($list_of_integers)
$rng->get($ndarray);

Example:

$x = zeroes 5,6;
$o = $rng->get(10,10); $rng->get($x);

πŸŽ€ get_int

This function creates an ndarray with given dimensions, or accepts an existing ndarray and fills it. get_int() returns integer values between 0 and $max.

Usage:

$ndarray = $rng->get($max, $list_of_integers)
$rng->get($max, $ndarray);

Example:

$x = zeroes 5,6; $max=100;
$o = $rng->get(10,10); $rng->get($x);

✨ get_uniform

This function creates an ndarray with given dimensions or accepts an existing ndarray and fills it. get_uniform() returns values 0<=x<1,

Usage:

$ndarray = $rng->get_uniform($list_of_integers)
$rng->get_uniform($ndarray);

Example:

$x = zeroes 5,6; $max=100;
$o = $rng->get_uniform(10,10); $rng->get_uniform($x);

🌸 get_uniform_pos

This function creates an ndarray with given dimensions or accepts an existing ndarray and fills it. get_uniform_pos() returns values 0<x<1,

Usage:

$ndarray = $rng->get_uniform_pos($list_of_integers)
$rng->get_uniform_pos($ndarray);

Example:

$x = zeroes 5,6;
$o = $rng->get_uniform_pos(10,10); $rng->get_uniform_pos($x);

πŸ”₯ ran_shuffle

Shuffles values in ndarray πŸƒ

Usage:

$rng->ran_shuffle($ndarray);

πŸ’œ ran_shuffle_vec

Shuffles values in ndarray πŸƒ (yes bestie, same energy, vec edition)

Usage:

$rng->ran_shuffle_vec(@vec);

🌈 ran_choose

Chooses values from $inndarray to $outndarray. she's picky. she's selective. she's got taste ✨

Usage:

$rng->ran_choose($inndarray,$outndarray);

🧚 ran_choose_vec

Chooses $n values from @vec.

Usage:

@chosen = $rng->ran_choose_vec($n,@vec);

πŸŽ€ ran_gaussian

Fills the output ndarray with random values from a Gaussian distribution with mean zero and standard deviation $sigma. the bell curve. the classic. the moment πŸ“Š

Usage:

 $ndarray = $rng->ran_gaussian($sigma,[list of integers = output ndarray dims]);
 $rng->ran_gaussian($sigma, $output_ndarray);

Example:

  $o = $rng->ran_gaussian($sigma,10,10);
  $rng->ran_gaussian($sigma,$o);

πŸ¦‹ ran_gaussian_var

This method is similar to "ran_gaussian" except that it takes the parameters of the distribution as an ndarray and returns an ndarray of equal dimensions. so like, sigma is now a whole array of sigmas. she's versatile πŸ’…

Usage:

$ndarray = $rng->ran_gaussian_var($sigma_ndarray);
$rng->ran_gaussian_var($sigma_ndarray, $output_ndarray);

Example:

$sigma_pdl = rvals zeroes 11,11;
$o = $rng->ran_gaussian_var($sigma_pdl);

⭐ ran_additive_gaussian

Add Gaussian noise of given sigma to an ndarray. sprinkle sprinkle ✨

Usage:

$rng->ran_additive_gaussian($sigma,$ndarray);

Example:

$rng->ran_additive_gaussian(1,$image);

🌸 ran_bivariate_gaussian

Generates $n bivariate gaussian random deviates. two variables, one glow-up πŸ’«

Usage:

$ndarray = $rng->ran_bivariate_gaussian($sigma_x,$sigma_y,$rho,$n);

Example:

$o = $rng->ran_bivariate_gaussian(1,2,0.5,1000);

πŸ“ ran_poisson

Fills the output ndarray by with random integer values from the Poisson distribution with mean $mu.

Usage:

$ndarray = $rng->ran_poisson($mu,[list of integers = output ndarray dims]);
$rng->ran_poisson($mu,$output_ndarray);

πŸ’– ran_poisson_var

Similar to "ran_poisson" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_poisson_var($mu_ndarray);

πŸŽ€ ran_additive_poisson

Add Poisson noise of given $mu to a $ndarray.

Usage:

$rng->ran_additive_poisson($mu,$ndarray);

Example:

$rng->ran_additive_poisson(1,$image);

πŸ”₯ ran_feed_poisson

This method simulates shot noise, taking the values of ndarray as values for $mu to be fed into the poissonian RNG. she's eating, and we're feeding her 🍽️

Usage:

$rng->ran_feed_poisson($ndarray);

Example:

$rng->ran_feed_poisson($image);

🧚 ran_bernoulli

Fills the output ndarray with random values 0 or 1, the result of a Bernoulli trial with probability $p. coin flip core πŸͺ™

Usage:

$ndarray = $rng->ran_bernoulli($p,[list of integers = output ndarray dims]);
$rng->ran_bernoulli($p,$output_ndarray);

🌈 ran_bernoulli_var

Similar to "ran_bernoulli" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_bernoulli_var($p_ndarray);

πŸ’œ ran_beta

Fills the output ndarray with random variates from the beta distribution with parameters $pa and $pb.

Usage:

$ndarray = $rng->ran_beta($pa,$pb,[list of integers = output ndarray dims]);
$rng->ran_beta($pa,$pb,$output_ndarray);

πŸ¦‹ ran_beta_var

Similar to "ran_beta" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_beta_var($a_ndarray, $b_ndarray);

⭐ ran_binomial

Fills the output ndarray with random integer values from the binomial distribution β€” that's the number of successes in $n independent trials with probability $p.

Usage:

$ndarray = $rng->ran_binomial($p,$n,[list of integers = output ndarray dims]);
$rng->ran_binomial($p,$n,$output_ndarray);

🌸 ran_binomial_var

Similar to "ran_binomial" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_binomial_var($p_ndarray, $n_ndarray);

πŸŽ€ ran_cauchy

Fills the output ndarray with random variates from the Cauchy distribution with scale parameter $pa.

Usage:

$ndarray = $rng->ran_cauchy($pa,[list of integers = output ndarray dims]);
$rng->ran_cauchy($pa,$output_ndarray);

πŸ“ ran_cauchy_var

Similar to "ran_cauchy" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_cauchy_var($a_ndarray);

✨ ran_chisq

Fills the output ndarray with random variates from the chi-squared distribution with $nu degrees of freedom.

Usage:

$ndarray = $rng->ran_chisq($nu,[list of integers = output ndarray dims]);
$rng->ran_chisq($nu,$output_ndarray);

πŸ’– ran_chisq_var

Similar to "ran_chisq" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_chisq_var($nu_ndarray);

πŸ”₯ ran_exponential

Fills the output ndarray with random variates from the exponential distribution with mean $mu.

Usage:

$ndarray = $rng->ran_exponential($mu,[list of integers = output ndarray dims]);
$rng->ran_exponential($mu,$output_ndarray);

🧚 ran_exponential_var

Similar to "ran_exponential" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_exponential_var($mu_ndarray);

🌈 ran_exppow

Fills the output ndarray with random variates from the exponential power distribution with scale parameter $pa and exponent $pb.

Usage:

$ndarray = $rng->ran_exppow($pa,$pb,[list of integers = output ndarray dims]);
$rng->ran_exppow($pa,$pb,$output_ndarray);

πŸ’œ ran_exppow_var

Similar to "ran_exppow" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_exppow_var($a_ndarray, $b_ndarray);

⭐ ran_fdist

Fills the output ndarray with random variates from the F-distribution with degrees of freedom $nu1 and $nu2.

Usage:

$ndarray = $rng->ran_fdist($nu1, $nu2,[list of integers = output ndarray dims]);
$rng->ran_fdist($nu1, $nu2,$output_ndarray);

πŸ¦‹ ran_fdist_var

Similar to "ran_fdist" except that it takes the distribution parameters as an ndarray and returns an ndarray of equal dimensions.

Usage:

$ndarray = $rng->ran_fdist_var($nu1_ndarray, $nu2_ndarray);

πŸŽ€ ran_flat

Fills the output ndarray with random variates from the flat (uniform) distribution from $la to $lb. flat like my emotional range when the tests pass on the first try 😌

Usage:

$ndarray = $rng->ran_flat($la,$lb,[list of integers = output ndarray dims]);
$rng->ran_flat($la,$lb,$output_ndarray);

ran_flat_var πŸŽ€

Okay so this is ran_flat's twin, except the distribution parameters roll in as an ndarray and you get an ndarray back with the exact same dimensions. Shape-matching, as it should be. ✨

Usage:

$ndarray = $rng->ran_flat_var($a_ndarray, $b_ndarray);

ran_gamma 🌸

Fills your output ndarray with random variates from the gamma distribution. Classic.

Usage:

$ndarray = $rng->ran_gamma($pa,$pb,[list of integers = output ndarray dims]);
$rng->ran_gamma($pa,$pb,$output_ndarray);

ran_gamma_var πŸ¦‹

Same energy as ran_gamma, but the distribution parameters arrive as an ndarray and what you get back is an ndarray of equal dimensions. Bestie behaviour. πŸ’…

Usage:

$ndarray = $rng->ran_gamma_var($a_ndarray, $b_ndarray);

ran_geometric ⭐

Fills the output ndarray with random integer values from the geometric distribution β€” that's the number of independent trials with probability $p until you hit the first success. So basically: how many tries until it finally works. 😭

Usage:

$ndarray = $rng->ran_geometric($p,[list of integers = output ndarray dims]);
$rng->ran_geometric($p,$output_ndarray);

ran_geometric_var πŸ’œ

ran_geometric but the distribution parameter is an ndarray and the return is an ndarray of the same dimensions. Matching, periodt.

Usage:

$ndarray = $rng->ran_geometric_var($p_ndarray);

ran_gumbel1 🌈

Fills the output ndarray with random variates from the Type-1 Gumbel distribution.

Usage:

$ndarray = $rng->ran_gumbel1($pa,$pb,[list of integers = output ndarray dims]);
$rng->ran_gumbel1($pa,$pb,$output_ndarray);

ran_gumbel1_var 🫢

Like ran_gumbel1, but the distribution parameters are an ndarray and the return is an ndarray of equal dimensions. Iconic of it.

Usage:

$ndarray = $rng->ran_gumbel1_var($a_ndarray, $b_ndarray);

ran_gumbel2 ✨

Fills the output ndarray with random variates from the Type-2 Gumbel distribution. Yes, there's a sequel. The second one. 🎬

Usage:

$ndarray = $rng->ran_gumbel2($pa,$pb,[list of integers = output ndarray dims]);
$rng->ran_gumbel2($pa,$pb,$output_ndarray);

ran_gumbel2_var πŸ“

ran_gumbel2, but the distribution parameters come as an ndarray and you get an ndarray of equal dimensions back. Consistent queen. πŸ‘‘

Usage:

$ndarray = $rng->ran_gumbel2_var($a_ndarray, $b_ndarray);

ran_hypergeometric πŸ”₯

Fills the output ndarray with random integer values from the hypergeometric distribution. Here's the vibe: if a population has $n1 elements of type 1 and $n2 elements of type 2, then the hypergeometric distribution gives you the probability of obtaining $x elements of type 1 in $t samples taken from the population without replacement. Note the no-replacement part, bestie β€” that's the whole plot twist. πŸ™ˆ

Usage:

$ndarray = $rng->ran_hypergeometric($n1, $n2, $t,[list of integers = output ndarray dims]);
$rng->ran_hypergeometric($n1, $n2, $t,$output_ndarray);

ran_hypergeometric_var 🧚

Same as ran_hypergeometric except the distribution parameters show up as an ndarray, and the return is an ndarray of equal dimensions. The pattern is the pattern, iykyk. πŸ’«

Usage:

$ndarray = $rng->ran_hypergeometric_var($n1_ndarray, $n2_ndarray, $t_ndarray);

ran_laplace πŸŽ€

Fills the output ndarray with random variates from the Laplace distribution with width $pa.

Usage:

$ndarray = $rng->ran_laplace($pa,[list of integers = output ndarray dims]);
$rng->ran_laplace($pa,$output_ndarray);

ran_laplace_var πŸ’–

Like ran_laplace, but the distribution parameter is an ndarray and the return is an ndarray of equal dimensions. So demure of it.

Usage:

$ndarray = $rng->ran_laplace_var($a_ndarray);

ran_levy 🌟

Fills the output ndarray with random variates from the Levy symmetric stable distribution with scale $c and exponent $alpha. (The usage below calls them $mu and $x β€” just roll with it, bestie, that's what the page says. πŸ’€)

Usage:

$ndarray = $rng->ran_levy($mu,$x,[list of integers = output ndarray dims]);
$rng->ran_levy($mu,$x,$output_ndarray);

ran_levy_var πŸ¦‹

ran_levy, but the distribution parameters are an ndarray and the return is an ndarray of equal dimensions. Same deal, different shape energy.

Usage:

$ndarray = $rng->ran_levy_var($mu_ndarray, $a_ndarray);

ran_logarithmic πŸ“

Fills the output ndarray with random integer values from the logarithmic distribution. Integers only, no decimals invited. πŸ’…

Usage:

$ndarray = $rng->ran_logarithmic($p,[list of integers = output ndarray dims]);
$rng->ran_logarithmic($p,$output_ndarray);

ran_logarithmic_var ⭐

Like ran_logarithmic except the distribution parameter comes in as an ndarray and you get an ndarray of equal dimensions back. Chef's kiss.

Usage:

$ndarray = $rng->ran_logarithmic_var($p_ndarray);

ran_logistic πŸ’œ

Fills the output ndarray with random random variates from the logistic distribution. (Yes, it really says "random random" β€” we love a double-confirmed random. 😭)

Usage:

$ndarray = $rng->ran_logistic($m,[list of integers = output ndarray dims]u)
$rng->ran_logistic($m,$output_ndarray)

ran_logistic_var 🌈

ran_logistic except the distribution parameter is an ndarray and the return is an ndarray of equal dimensions. The var functions stay winning. πŸ†

Usage:

$ndarray = $rng->ran_logistic_var($m_ndarray);

ran_lognormal 🌸

Fills the output ndarray with random variates from the lognormal distribution with parameters $mu (location) and $sigma (scale). Two params, both named, both doing their job.

Usage:

$ndarray = $rng->ran_lognormal($mu,$sigma,[list of integers = output ndarray dims]);
$rng->ran_lognormal($mu,$sigma,$output_ndarray);

ran_lognormal_var 🫢

ran_lognormal, but the distribution parameters are ndarrays and you get an ndarray of equal dimensions. Matching params, matching dims. 🎯

Usage:

$ndarray = $rng->ran_lognormal_var($mu_ndarray, $sigma_ndarray);

ran_negative_binomial πŸ”₯

Fills the output ndarray with random integer values from the negative binomial distribution β€” that's the number of failures happening before $n successes in independent trials, with probability $p of success. And important: $n is not required to be an integer. Let it be free, let it be a float. πŸ•ŠοΈ

Usage:

$ndarray = $rng->ran_negative_binomial($p,$n,[list of integers = output ndarray dims]);
$rng->ran_negative_binomial($p,$n,$output_ndarray);

ran_negative_binomial_var 🧚

Like ran_negative_binomial, except the distribution parameters are an ndarray and the return is an ndarray of equal dimensions. Slay.

Usage:

$ndarray = $rng->ran_negative_binomial_var($p_ndarray, $n_ndarray);

ran_pareto πŸ‘‘

Fills the output ndarray with random variates from the Pareto distribution of order $pa and scale $lb.

Usage:

$ndarray = $rng->ran_pareto($pa,$lb,[list of integers = output ndarray dims]);
$rng->ran_pareto($pa,$lb,$output_ndarray);

ran_pareto_var πŸ’–

ran_pareto but the distribution parameters arrive as an ndarray and the return is an ndarray of equal dimensions. We love a symmetric little setup. ✨

Usage:

$ndarray = $rng->ran_pareto_var($a_ndarray, $b_ndarray);

ran_pascal πŸŽ€

Fills the output ndarray with random integer values from the Pascal distribution. Plot twist: the Pascal distribution is literally just a negative binomial distribution (see ran_negative_binomial) with an integer value of $n. It's the same girl with a different name. πŸ’…

Usage:

$ndarray = $rng->ran_pascal($p,$n,[list of integers = output ndarray dims]);
$rng->ran_pascal($p,$n,$output_ndarray);

ran_pascal_var πŸ¦‹

Like ran_pascal except the distribution parameters are an ndarray and the return is an ndarray of equal dimensions. Keeping the family resemblance strong.

Usage:

$ndarray = $rng->ran_pascal_var($p_ndarray, $n_ndarray);

ran_rayleigh ⭐

Fills the output ndarray with random variates from the Rayleigh distribution with scale parameter $sigma.

Usage:

$ndarray = $rng->ran_rayleigh($sigma,[list of integers = output ndarray dims]);
$rng->ran_rayleigh($sigma,$output_ndarray);

ran_rayleigh_var πŸ’œ

ran_rayleigh, except the distribution parameter is an ndarray and what comes back is an ndarray of equal dimensions. Per usual, and per usual it's perfect. 😌

Usage:

$ndarray = $rng->ran_rayleigh_var($sigma_ndarray);

ran_rayleigh_tail 🌈

Fills the output ndarray with random variates from the tail of the Rayleigh distribution, with scale parameter $sigma and a lower limit of $la. Yes, we're doing the tail end of it. The tail is the moment. πŸ‘

Usage:

$ndarray = $rng->ran_rayleigh_tail($la,$sigma,[list of integers = output ndarray dims]);
$rng->ran_rayleigh_tail($x,$sigma,$output_ndarray);

ran_rayleigh_tail_var πŸ“

Like ran_rayleigh_tail, except the distribution parameters are an ndarray and the return is an ndarray of equal dimensions. Consistency is the flex. πŸ’«

Usage:

$ndarray = $rng->ran_rayleigh_tail_var($a_ndarray, $sigma_ndarray);

ran_tdist 🫢

Fills the output ndarray with random variates from the t-distribution (AKA Student's t-distribution) with $nu degrees of freedom.

Usage:

$ndarray = $rng->ran_tdist($nu,[list of integers = output ndarray dims]);
$rng->ran_tdist($nu,$output_ndarray);

ran_tdist_var ✨

ran_tdist but the distribution parameter is an ndarray and the return is an ndarray of equal dimensions. No notes.

Usage:

$ndarray = $rng->ran_tdist_var($nu_ndarray);

ran_ugaussian_tail 🌸

Fills the output ndarray with random variates from the upper tail of a Gaussian distribution with standard deviation = 1 (AKA the unit Gaussian distribution). Upper tail only, we're not doing the whole curve today. πŸ‘‘

Usage:

$ndarray = $rng->ran_ugaussian_tail($tail,[list of integers = output ndarray dims]);
$rng->ran_ugaussian_tail($tail,$output_ndarray);

ran_ugaussian_tail_var 🧚

Like ran_ugaussian_tail except the distribution parameter is an ndarray and the return is an ndarray of equal dimensions. Same tail, array-shaped. πŸ¦‹

Usage:

$ndarray = $rng->ran_ugaussian_tail_var($tail_ndarray);

ran_weibull πŸ’–

Fills the output ndarray with random variates from the Weibull distribution with scale $pa and exponent $pb. Heads up: some literature uses lambda for $pa and k for $pb, so if you're reading a paper and feel confused, it's them, not you. 😭

Usage:

$ndarray = $rng->ran_weibull($pa,$pb,[list of integers = output ndarray dims]);
$rng->ran_weibull($pa,$pb,$output_ndarray);

ran_weibull_var πŸŽ€

ran_weibull, except the distribution parameters come as an ndarray and the return is an ndarray of equal dimensions. The var crew never misses. πŸ†

Usage:

$ndarray = $rng->ran_weibull_var($a_ndarray, $b_ndarray);

ran_dir πŸ”₯

Returns $n random vectors in $ndim dimensions. Directions, generated, done.

Usage:

$ndarray = $rng->ran_dir($ndim,$n);

Example:

$o = $rng->ran_dir($ndim,$n);

ran_discrete_preproc ⭐

This method returns a handle that you then have to use when you call ran_discrete. You're the one who specifies the probability of the integer numbers that get returned by ran_discrete. So like, set it up here, use it there. Two-step process, bestie, don't skip step one. πŸ’…

Usage:

$discrete_dist_handle = $rng->ran_discrete_preproc($double_ndarray_prob);

Example:

$prob = pdl [0.1,0.3,0.6];
$ddh = $rng->ran_discrete_preproc($prob);
$o = $rng->ran_discrete($discrete_dist_handle,100);

ran_discrete πŸ’œ

This is the one you use to actually get the samples you want, once a proper handle has been established (see ran_discrete_preproc()). No handle, no samples. That's the rule. πŸŽ€

Usage:

$ndarray = $rng->ran_discrete($discrete_dist_handle,$num);

Example:

$prob = pdl [0.1,0.3,0.6];
$ddh = $rng->ran_discrete_preproc($prob);
$o = $rng->ran_discrete($discrete_dist_handle,100);

ran_ver πŸ¦‹

Returns an ndarray with $n values generated by the Verhulst map, starting from $x0 with parameter $r. Chaos math but make it cute. 🌈

Usage:

$rng->ran_ver($x0, $r, $n);

ran_caos</p>

okay this one is giving chaos theory but make it cute πŸ’« it hands you back values from Verhulst's map with $r=4.0 and a randomly chosen $x0. and the values get scaled by $m, bestie, so they're not just tiny little babies anymore.

how you call it:

$rng->ran_caos($m,$n);

πŸ› BUGS πŸ›

ngl we love feedback here, it's not giving "leave a bad review", it's giving "come gossip with us about what's broken" πŸ’Œ if you find a bug, log it in the PDL bug database β€” and guess what, that database is always linked right from http://pdl.perl.org/ so you can't even miss it. no cap.


πŸ‘€ SEE ALSO πŸ‘€


πŸ’– AUTHOR πŸ’–

this file copyright (C) 1999 Christian Pellegrin <chri@infis.univ.trieste.it>. Docs mangled by C. Soeller. All rights reserved. there is no warranty, like at all, zero, nada πŸ™ˆ you are allowed to redistribute this software / documentation under certain conditions β€” for the deets, peep the file COPYING in the PDL distribution. and listen: if this file ever gets separated from the PDL distribution, the copyright notice should be included in the file. keep it together, bestie 🫢

The GSL RNG and randist modules were written by James Theiler. absolute legend, we stan ⭐


and that's a wrap on the whole page, babe πŸŽ€ this one's from perl v5.38.2, dated 2024-04-10, and it's RNG(3pm) β€” go forth and generate some stunning random numbers, you've got this πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from