1RNG(3) User Contributed Perl Documentation RNG(3)
2
3
4
6 PDL::GSL::RNG - PDL interface to RNG and randist routines in GSL
7
9 This is an interface to the rng and randist packages present in the GNU
10 Scientific Library.
11
13 use PDL;
14 use PDL::GSL::RNG;
15
16 $rng = PDL::GSL::RNG->new('taus');
17
18 $rng->set_seed(time());
19
20 $x=zeroes(5,5,5)
21
22 $rng->get_uniform($x); # inplace
23
24 $y=$rng->get_uniform(3,4,5); # creates new pdl
25
27 Throughout this documentation we strive to use the same variables that
28 are present in the original GSL documentation (see See Also).
29 Oftentimes those variables are called "a" and "b". Since good Perl
30 coding practices discourage the use of Perl variables $a and $b, here
31 we refer to Parameters "a" and "b" as $pa and $pb, respectively, and
32 Limits (of domain or integration) as $la and $lb.
33
35 new
36 The new method initializes a new instance of the RNG.
37
38 The available RNGs are:
39
40 coveyou cmrg fishman18 fishman20 fishman2x gfsr4 knuthran
41 knuthran2 knuthran2002 lecuyer21 minstd mrg mt19937 mt19937_1999
42 mt19937_1998 r250 ran0 ran1 ran2 ran3 rand rand48 random128_bsd
43 random128_glibc2 random128_libc5 random256_bsd random256_glibc2
44 random256_libc5 random32_bsd random32_glibc2 random32_libc5
45 random64_bsd random64_glibc2 random64_libc5 random8_bsd
46 random8_glibc2 random8_libc5 random_bsd random_glibc2
47 random_libc5 randu ranf ranlux ranlux389 ranlxd1 ranlxd2 ranlxs0
48 ranlxs1 ranlxs2 ranmar slatec taus taus2 taus113 transputer tt800
49 uni uni32 vax waterman14 zuf default
50
51 The last one (default) uses the environment variable GSL_RNG_TYPE.
52
53 Note that only a few of these rngs are recommended for general use.
54 Please check the GSL documentation for more information.
55
56 Usage:
57
58 $blessed_ref = PDL::GSL::RNG->new($RNG_name);
59
60 Example:
61
62 $rng = PDL::GSL::RNG->new('taus');
63
64 set_seed
65 Sets the RNG seed.
66
67 Usage:
68
69 $rng->set_seed($integer);
70 # or
71 $rng = PDL::GSL::RNG->new('taus')->set_seed($integer);
72
73 Example:
74
75 $rng->set_seed(666);
76
77 min
78 Return the minimum value generable by this RNG.
79
80 Usage:
81
82 $integer = $rng->min();
83
84 Example:
85
86 $min = $rng->min(); $max = $rng->max();
87
88 max
89 Return the maximum value generable by the RNG.
90
91 Usage:
92
93 $integer = $rng->max();
94
95 Example:
96
97 $min = $rng->min(); $max = $rng->max();
98
99 name
100 Returns the name of the RNG.
101
102 Usage:
103
104 $string = $rng->name();
105
106 Example:
107
108 $name = $rng->name();
109
110 get
111 This function creates an ndarray with given dimensions or accepts an
112 existing ndarray and fills it. get() returns integer values between a
113 minimum and a maximum specific to every RNG.
114
115 Usage:
116
117 $ndarray = $rng->get($list_of_integers)
118 $rng->get($ndarray);
119
120 Example:
121
122 $x = zeroes 5,6;
123 $o = $rng->get(10,10); $rng->get($x);
124
125 get_int
126 This function creates an ndarray with given dimensions or accepts an
127 existing ndarray and fills it. get_int() returns integer values between
128 0 and $max.
129
130 Usage:
131
132 $ndarray = $rng->get($max, $list_of_integers)
133 $rng->get($max, $ndarray);
134
135 Example:
136
137 $x = zeroes 5,6; $max=100;
138 $o = $rng->get(10,10); $rng->get($x);
139
140 get_uniform
141 This function creates an ndarray with given dimensions or accepts an
142 existing ndarray and fills it. get_uniform() returns values 0<=x<1,
143
144 Usage:
145
146 $ndarray = $rng->get_uniform($list_of_integers)
147 $rng->get_uniform($ndarray);
148
149 Example:
150
151 $x = zeroes 5,6; $max=100;
152 $o = $rng->get_uniform(10,10); $rng->get_uniform($x);
153
154 get_uniform_pos
155 This function creates an ndarray with given dimensions or accepts an
156 existing ndarray and fills it. get_uniform_pos() returns values 0<x<1,
157
158 Usage:
159
160 $ndarray = $rng->get_uniform_pos($list_of_integers)
161 $rng->get_uniform_pos($ndarray);
162
163 Example:
164
165 $x = zeroes 5,6;
166 $o = $rng->get_uniform_pos(10,10); $rng->get_uniform_pos($x);
167
168 ran_shuffle
169 Shuffles values in ndarray
170
171 Usage:
172
173 $rng->ran_shuffle($ndarray);
174
175 ran_shuffle_vec
176 Shuffles values in ndarray
177
178 Usage:
179
180 $rng->ran_shuffle_vec(@vec);
181
182 ran_choose
183 Chooses values from $inndarray to $outndarray.
184
185 Usage:
186
187 $rng->ran_choose($inndarray,$outndarray);
188
189 ran_choose_vec
190 Chooses $n values from @vec.
191
192 Usage:
193
194 @chosen = $rng->ran_choose_vec($n,@vec);
195
196 ran_gaussian
197 Fills output ndarray with random values from Gaussian distribution with
198 mean zero and standard deviation $sigma.
199
200 Usage:
201
202 $ndarray = $rng->ran_gaussian($sigma,[list of integers = output ndarray dims]);
203 $rng->ran_gaussian($sigma, $output_ndarray);
204
205 Example:
206
207 $o = $rng->ran_gaussian($sigma,10,10);
208 $rng->ran_gaussian($sigma,$o);
209
210 ran_gaussian_var
211 This method is similar to "ran_gaussian" except that it takes the
212 parameters of the distribution as an ndarray and returns an ndarray of
213 equal dimensions.
214
215 Usage:
216
217 $ndarray = $rng->ran_gaussian_var($sigma_ndarray);
218 $rng->ran_gaussian_var($sigma_ndarray, $output_ndarray);
219
220 Example:
221
222 $sigma_pdl = rvals zeroes 11,11;
223 $o = $rng->ran_gaussian_var($sigma_pdl);
224
225 ran_additive_gaussian
226 Add Gaussian noise of given sigma to an ndarray.
227
228 Usage:
229
230 $rng->ran_additive_gaussian($sigma,$ndarray);
231
232 Example:
233
234 $rng->ran_additive_gaussian(1,$image);
235
236 ran_bivariate_gaussian
237 Generates $n bivariate gaussian random deviates.
238
239 Usage:
240
241 $ndarray = $rng->ran_bivariate_gaussian($sigma_x,$sigma_y,$rho,$n);
242
243 Example:
244
245 $o = $rng->ran_bivariate_gaussian(1,2,0.5,1000);
246
247 ran_poisson
248 Fills output ndarray by with random integer values from the Poisson
249 distribution with mean $mu.
250
251 Usage:
252
253 $ndarray = $rng->ran_poisson($mu,[list of integers = output ndarray dims]);
254 $rng->ran_poisson($mu,$output_ndarray);
255
256 ran_poisson_var
257 Similar to "ran_poisson" except that it takes the distribution
258 parameters as an ndarray and returns an ndarray of equal dimensions.
259
260 Usage:
261
262 $ndarray = $rng->ran_poisson_var($mu_ndarray);
263
264 ran_additive_poisson
265 Add Poisson noise of given $mu to a $ndarray.
266
267 Usage:
268
269 $rng->ran_additive_poisson($mu,$ndarray);
270
271 Example:
272
273 $rng->ran_additive_poisson(1,$image);
274
275 ran_feed_poisson
276 This method simulates shot noise, taking the values of ndarray as
277 values for $mu to be fed in the poissonian RNG.
278
279 Usage:
280
281 $rng->ran_feed_poisson($ndarray);
282
283 Example:
284
285 $rng->ran_feed_poisson($image);
286
287 ran_bernoulli
288 Fills output ndarray with random values 0 or 1, the result of a
289 Bernoulli trial with probability $p.
290
291 Usage:
292
293 $ndarray = $rng->ran_bernoulli($p,[list of integers = output ndarray dims]);
294 $rng->ran_bernoulli($p,$output_ndarray);
295
296 ran_bernoulli_var
297 Similar to "ran_bernoulli" except that it takes the distribution
298 parameters as an ndarray and returns an ndarray of equal dimensions.
299
300 Usage:
301
302 $ndarray = $rng->ran_bernoulli_var($p_ndarray);
303
304 ran_beta
305 Fills output ndarray with random variates from the beta distribution
306 with parameters $pa and $pb.
307
308 Usage:
309
310 $ndarray = $rng->ran_beta($pa,$pb,[list of integers = output ndarray dims]);
311 $rng->ran_beta($pa,$pb,$output_ndarray);
312
313 ran_beta_var
314 Similar to "ran_beta" except that it takes the distribution parameters
315 as an ndarray and returns an ndarray of equal dimensions.
316
317 Usage:
318
319 $ndarray = $rng->ran_beta_var($a_ndarray, $b_ndarray);
320
321 ran_binomial
322 Fills output ndarray with random integer values from the binomial
323 distribution, the number of successes in $n independent trials with
324 probability $p.
325
326 Usage:
327
328 $ndarray = $rng->ran_binomial($p,$n,[list of integers = output ndarray dims]);
329 $rng->ran_binomial($p,$n,$output_ndarray);
330
331 ran_binomial_var
332 Similar to "ran_binomial" except that it takes the distribution
333 parameters as an ndarray and returns an ndarray of equal dimensions.
334
335 Usage:
336
337 $ndarray = $rng->ran_binomial_var($p_ndarray, $n_ndarray);
338
339 ran_cauchy
340 Fills output ndarray with random variates from the Cauchy distribution
341 with scale parameter $pa.
342
343 Usage:
344
345 $ndarray = $rng->ran_cauchy($pa,[list of integers = output ndarray dims]);
346 $rng->ran_cauchy($pa,$output_ndarray);
347
348 ran_cauchy_var
349 Similar to "ran_cauchy" except that it takes the distribution
350 parameters as an ndarray and returns an ndarray of equal dimensions.
351
352 Usage:
353
354 $ndarray = $rng->ran_cauchy_var($a_ndarray);
355
356 ran_chisq
357 Fills output ndarray with random variates from the chi-squared
358 distribution with $nu degrees of freedom.
359
360 Usage:
361
362 $ndarray = $rng->ran_chisq($nu,[list of integers = output ndarray dims]);
363 $rng->ran_chisq($nu,$output_ndarray);
364
365 ran_chisq_var
366 Similar to "ran_chisq" except that it takes the distribution parameters
367 as an ndarray and returns an ndarray of equal dimensions.
368
369 Usage:
370
371 $ndarray = $rng->ran_chisq_var($nu_ndarray);
372
373 ran_exponential
374 Fills output ndarray with random variates from the exponential
375 distribution with mean $mu.
376
377 Usage:
378
379 $ndarray = $rng->ran_exponential($mu,[list of integers = output ndarray dims]);
380 $rng->ran_exponential($mu,$output_ndarray);
381
382 ran_exponential_var
383 Similar to "ran_exponential" except that it takes the distribution
384 parameters as an ndarray and returns an ndarray of equal dimensions.
385
386 Usage:
387
388 $ndarray = $rng->ran_exponential_var($mu_ndarray);
389
390 ran_exppow
391 Fills output ndarray with random variates from the exponential power
392 distribution with scale parameter $pa and exponent $pb.
393
394 Usage:
395
396 $ndarray = $rng->ran_exppow($pa,$pb,[list of integers = output ndarray dims]);
397 $rng->ran_exppow($pa,$pb,$output_ndarray);
398
399 ran_exppow_var
400 Similar to "ran_exppow" except that it takes the distribution
401 parameters as an ndarray and returns an ndarray of equal dimensions.
402
403 Usage:
404
405 $ndarray = $rng->ran_exppow_var($a_ndarray, $b_ndarray);
406
407 ran_fdist
408 Fills output ndarray with random variates from the F-distribution with
409 degrees of freedom $nu1 and $nu2.
410
411 Usage:
412
413 $ndarray = $rng->ran_fdist($nu1, $nu2,[list of integers = output ndarray dims]);
414 $rng->ran_fdist($nu1, $nu2,$output_ndarray);
415
416 ran_fdist_var
417 Similar to "ran_fdist" except that it takes the distribution parameters
418 as an ndarray and returns an ndarray of equal dimensions.
419
420 Usage:
421
422 $ndarray = $rng->ran_fdist_var($nu1_ndarray, $nu2_ndarray);
423
424 ran_flat
425 Fills output ndarray with random variates from the flat (uniform)
426 distribution from $la to $lb.
427
428 Usage:
429
430 $ndarray = $rng->ran_flat($la,$lb,[list of integers = output ndarray dims]);
431 $rng->ran_flat($la,$lb,$output_ndarray);
432
433 ran_flat_var
434 Similar to "ran_flat" except that it takes the distribution parameters
435 as an ndarray and returns an ndarray of equal dimensions.
436
437 Usage:
438
439 $ndarray = $rng->ran_flat_var($a_ndarray, $b_ndarray);
440
441 ran_gamma
442 Fills output ndarray with random variates from the gamma distribution.
443
444 Usage:
445
446 $ndarray = $rng->ran_gamma($pa,$pb,[list of integers = output ndarray dims]);
447 $rng->ran_gamma($pa,$pb,$output_ndarray);
448
449 ran_gamma_var
450 Similar to "ran_gamma" except that it takes the distribution parameters
451 as an ndarray and returns an ndarray of equal dimensions.
452
453 Usage:
454
455 $ndarray = $rng->ran_gamma_var($a_ndarray, $b_ndarray);
456
457 ran_geometric
458 Fills output ndarray with random integer values from the geometric
459 distribution, the number of independent trials with probability $p
460 until the first success.
461
462 Usage:
463
464 $ndarray = $rng->ran_geometric($p,[list of integers = output ndarray dims]);
465 $rng->ran_geometric($p,$output_ndarray);
466
467 ran_geometric_var
468 Similar to "ran_geometric" except that it takes the distribution
469 parameters as an ndarray and returns an ndarray of equal dimensions.
470
471 Usage:
472
473 $ndarray = $rng->ran_geometric_var($p_ndarray);
474
475 ran_gumbel1
476 Fills output ndarray with random variates from the Type-1 Gumbel
477 distribution.
478
479 Usage:
480
481 $ndarray = $rng->ran_gumbel1($pa,$pb,[list of integers = output ndarray dims]);
482 $rng->ran_gumbel1($pa,$pb,$output_ndarray);
483
484 ran_gumbel1_var
485 Similar to "ran_gumbel1" except that it takes the distribution
486 parameters as an ndarray and returns an ndarray of equal dimensions.
487
488 Usage:
489
490 $ndarray = $rng->ran_gumbel1_var($a_ndarray, $b_ndarray);
491
492 ran_gumbel2
493 Fills output ndarray with random variates from the Type-2 Gumbel
494 distribution.
495
496 Usage:
497
498 $ndarray = $rng->ran_gumbel2($pa,$pb,[list of integers = output ndarray dims]);
499 $rng->ran_gumbel2($pa,$pb,$output_ndarray);
500
501 ran_gumbel2_var
502 Similar to "ran_gumbel2" except that it takes the distribution
503 parameters as an ndarray and returns an ndarray of equal dimensions.
504
505 Usage:
506
507 $ndarray = $rng->ran_gumbel2_var($a_ndarray, $b_ndarray);
508
509 ran_hypergeometric
510 Fills output ndarray with random integer values from the hypergeometric
511 distribution. If a population contains $n1 elements of type 1 and $n2
512 elements of type 2 then the hypergeometric distribution gives the
513 probability of obtaining $x elements of type 1 in $t samples from the
514 population without replacement.
515
516 Usage:
517
518 $ndarray = $rng->ran_hypergeometric($n1, $n2, $t,[list of integers = output ndarray dims]);
519 $rng->ran_hypergeometric($n1, $n2, $t,$output_ndarray);
520
521 ran_hypergeometric_var
522 Similar to "ran_hypergeometric" except that it takes the distribution
523 parameters as an ndarray and returns an ndarray of equal dimensions.
524
525 Usage:
526
527 $ndarray = $rng->ran_hypergeometric_var($n1_ndarray, $n2_ndarray, $t_ndarray);
528
529 ran_laplace
530 Fills output ndarray with random variates from the Laplace distribution
531 with width $pa.
532
533 Usage:
534
535 $ndarray = $rng->ran_laplace($pa,[list of integers = output ndarray dims]);
536 $rng->ran_laplace($pa,$output_ndarray);
537
538 ran_laplace_var
539 Similar to "ran_laplace" except that it takes the distribution
540 parameters as an ndarray and returns an ndarray of equal dimensions.
541
542 Usage:
543
544 $ndarray = $rng->ran_laplace_var($a_ndarray);
545
546 ran_levy
547 Fills output ndarray with random variates from the Levy symmetric
548 stable distribution with scale $c and exponent $alpha.
549
550 Usage:
551
552 $ndarray = $rng->ran_levy($mu,$x,[list of integers = output ndarray dims]);
553 $rng->ran_levy($mu,$x,$output_ndarray);
554
555 ran_levy_var
556 Similar to "ran_levy" except that it takes the distribution parameters
557 as an ndarray and returns an ndarray of equal dimensions.
558
559 Usage:
560
561 $ndarray = $rng->ran_levy_var($mu_ndarray, $a_ndarray);
562
563 ran_logarithmic
564 Fills output ndarray with random integer values from the logarithmic
565 distribution.
566
567 Usage:
568
569 $ndarray = $rng->ran_logarithmic($p,[list of integers = output ndarray dims]);
570 $rng->ran_logarithmic($p,$output_ndarray);
571
572 ran_logarithmic_var
573 Similar to "ran_logarithmic" except that it takes the distribution
574 parameters as an ndarray and returns an ndarray of equal dimensions.
575
576 Usage:
577
578 $ndarray = $rng->ran_logarithmic_var($p_ndarray);
579
580 ran_logistic
581 Fills output ndarray with random random variates from the logistic
582 distribution.
583
584 Usage:
585
586 $ndarray = $rng->ran_logistic($m,[list of integers = output ndarray dims]u)
587 $rng->ran_logistic($m,$output_ndarray)
588
589 ran_logistic_var
590 Similar to "ran_logistic" except that it takes the distribution
591 parameters as an ndarray and returns an ndarray of equal dimensions.
592
593 Usage:
594
595 $ndarray = $rng->ran_logistic_var($m_ndarray);
596
597 ran_lognormal
598 Fills output ndarray with random variates from the lognormal
599 distribution with parameters $mu (location) and $sigma (scale).
600
601 Usage:
602
603 $ndarray = $rng->ran_lognormal($mu,$sigma,[list of integers = output ndarray dims]);
604 $rng->ran_lognormal($mu,$sigma,$output_ndarray);
605
606 ran_lognormal_var
607 Similar to "ran_lognormal" except that it takes the distribution
608 parameters as an ndarray and returns an ndarray of equal dimensions.
609
610 Usage:
611
612 $ndarray = $rng->ran_lognormal_var($mu_ndarray, $sigma_ndarray);
613
614 ran_negative_binomial
615 Fills output ndarray with random integer values from the negative
616 binomial distribution, the number of failures occurring before $n
617 successes in independent trials with probability $p of success. Note
618 that $n is not required to be an integer.
619
620 Usage:
621
622 $ndarray = $rng->ran_negative_binomial($p,$n,[list of integers = output ndarray dims]);
623 $rng->ran_negative_binomial($p,$n,$output_ndarray);
624
625 ran_negative_binomial_var
626 Similar to "ran_negative_binomial" except that it takes the
627 distribution parameters as an ndarray and returns an ndarray of equal
628 dimensions.
629
630 Usage:
631
632 $ndarray = $rng->ran_negative_binomial_var($p_ndarray, $n_ndarray);
633
634 ran_pareto
635 Fills output ndarray with random variates from the Pareto distribution
636 of order $pa and scale $lb.
637
638 Usage:
639
640 $ndarray = $rng->ran_pareto($pa,$lb,[list of integers = output ndarray dims]);
641 $rng->ran_pareto($pa,$lb,$output_ndarray);
642
643 ran_pareto_var
644 Similar to "ran_pareto" except that it takes the distribution
645 parameters as an ndarray and returns an ndarray of equal dimensions.
646
647 Usage:
648
649 $ndarray = $rng->ran_pareto_var($a_ndarray, $b_ndarray);
650
651 ran_pascal
652 Fills output ndarray with random integer values from the Pascal
653 distribution. The Pascal distribution is simply a negative binomial
654 distribution (see "ran_negative_binomial") with an integer value of $n.
655
656 Usage:
657
658 $ndarray = $rng->ran_pascal($p,$n,[list of integers = output ndarray dims]);
659 $rng->ran_pascal($p,$n,$output_ndarray);
660
661 ran_pascal_var
662 Similar to "ran_pascal" except that it takes the distribution
663 parameters as an ndarray and returns an ndarray of equal dimensions.
664
665 Usage:
666
667 $ndarray = $rng->ran_pascal_var($p_ndarray, $n_ndarray);
668
669 ran_rayleigh
670 Fills output ndarray with random variates from the Rayleigh
671 distribution with scale parameter $sigma.
672
673 Usage:
674
675 $ndarray = $rng->ran_rayleigh($sigma,[list of integers = output ndarray dims]);
676 $rng->ran_rayleigh($sigma,$output_ndarray);
677
678 ran_rayleigh_var
679 Similar to "ran_rayleigh" except that it takes the distribution
680 parameters as an ndarray and returns an ndarray of equal dimensions.
681
682 Usage:
683
684 $ndarray = $rng->ran_rayleigh_var($sigma_ndarray);
685
686 ran_rayleigh_tail
687 Fills output ndarray with random variates from the tail of the Rayleigh
688 distribution with scale parameter $sigma and a lower limit of $la.
689
690 Usage:
691
692 $ndarray = $rng->ran_rayleigh_tail($la,$sigma,[list of integers = output ndarray dims]);
693 $rng->ran_rayleigh_tail($x,$sigma,$output_ndarray);
694
695 ran_rayleigh_tail_var
696 Similar to "ran_rayleigh_tail" except that it takes the distribution
697 parameters as an ndarray and returns an ndarray of equal dimensions.
698
699 Usage:
700
701 $ndarray = $rng->ran_rayleigh_tail_var($a_ndarray, $sigma_ndarray);
702
703 ran_tdist
704 Fills output ndarray with random variates from the t-distribution (AKA
705 Student's t-distribution) with $nu degrees of freedom.
706
707 Usage:
708
709 $ndarray = $rng->ran_tdist($nu,[list of integers = output ndarray dims]);
710 $rng->ran_tdist($nu,$output_ndarray);
711
712 ran_tdist_var
713 Similar to "ran_tdist" except that it takes the distribution parameters
714 as an ndarray and returns an ndarray of equal dimensions.
715
716 Usage:
717
718 $ndarray = $rng->ran_tdist_var($nu_ndarray);
719
720 ran_ugaussian_tail
721 Fills output ndarray with random variates from the upper tail of a
722 Gaussian distribution with "standard deviation = 1" (AKA unit Gaussian
723 distribution).
724
725 Usage:
726
727 $ndarray = $rng->ran_ugaussian_tail($tail,[list of integers = output ndarray dims]);
728 $rng->ran_ugaussian_tail($tail,$output_ndarray);
729
730 ran_ugaussian_tail_var
731 Similar to "ran_ugaussian_tail" except that it takes the distribution
732 parameters as an ndarray and returns an ndarray of equal dimensions.
733
734 Usage:
735
736 $ndarray = $rng->ran_ugaussian_tail_var($tail_ndarray);
737
738 ran_weibull
739 Fills output ndarray with random variates from the Weibull distribution
740 with scale $pa and exponent $pb. (Some literature uses "lambda" for $pa
741 and "k" for $pb.)
742
743 Usage:
744
745 $ndarray = $rng->ran_weibull($pa,$pb,[list of integers = output ndarray dims]);
746 $rng->ran_weibull($pa,$pb,$output_ndarray);
747
748 ran_weibull_var
749 Similar to "ran_weibull" except that it takes the distribution
750 parameters as an ndarray and returns an ndarray of equal dimensions.
751
752 Usage:
753
754 $ndarray = $rng->ran_weibull_var($a_ndarray, $b_ndarray);
755
756 ran_dir
757 Returns $n random vectors in $ndim dimensions.
758
759 Usage:
760
761 $ndarray = $rng->ran_dir($ndim,$n);
762
763 Example:
764
765 $o = $rng->ran_dir($ndim,$n);
766
767 ran_discrete_preproc
768 This method returns a handle that must be used when calling
769 "ran_discrete". You specify the probability of the integer number that
770 are returned by "ran_discrete".
771
772 Usage:
773
774 $discrete_dist_handle = $rng->ran_discrete_preproc($double_ndarray_prob);
775
776 Example:
777
778 $prob = pdl [0.1,0.3,0.6];
779 $ddh = $rng->ran_discrete_preproc($prob);
780 $o = $rng->ran_discrete($discrete_dist_handle,100);
781
782 ran_discrete
783 Is used to get the desired samples once a proper handle has been
784 enstablished (see ran_discrete_preproc()).
785
786 Usage:
787
788 $ndarray = $rng->ran_discrete($discrete_dist_handle,$num);
789
790 Example:
791
792 $prob = pdl [0.1,0.3,0.6];
793 $ddh = $rng->ran_discrete_preproc($prob);
794 $o = $rng->ran_discrete($discrete_dist_handle,100);
795
796 ran_ver
797 Returns an ndarray with $n values generated by the Verhulst map from
798 $x0 and parameter $r.
799
800 Usage:
801
802 $rng->ran_ver($x0, $r, $n);
803
804 ran_caos
805 Returns values from Verhuls map with "$r=4.0" and randomly chosen $x0.
806 The values are scaled by $m.
807
808 Usage:
809
810 $rng->ran_caos($m,$n);
811
813 Feedback is welcome. Log bugs in the PDL bug database (the database is
814 always linked from <http://pdl.perl.org/>).
815
817 PDL
818
819 The GSL documentation for random number distributions is online at
820 <https://www.gnu.org/software/gsl/doc/html/randist.html>
821
823 This file copyright (C) 1999 Christian Pellegrin
824 <chri@infis.univ.trieste.it> Docs mangled by C. Soeller. All rights
825 reserved. There is no warranty. You are allowed to redistribute this
826 software / documentation under certain conditions. For details, see the
827 file COPYING in the PDL distribution. If this file is separated from
828 the PDL distribution, the copyright notice should be included in the
829 file.
830
831 The GSL RNG and randist modules were written by James Theiler.
832
833
834
835perl v5.36.0 2023-01-20 RNG(3)