Debian Codegraph @

pm/Math/GSL/RNG.pm.2.4

raw ◀ ▶
Source reconstructed at patch state 0 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 # This file was automatically generated by SWIG (https://www.swig.org).
2 # Version 4.2.0
3 #
4 # Do not make changes to this file unless you know what you are doing - modify
5 # the SWIG interface file instead.
6
7 package Math::GSL::RNG;
8 use base qw(Exporter);
9 use base qw(DynaLoader);
10 package Math::GSL::RNGc;
11 bootstrap Math::GSL::RNG;
12 package Math::GSL::RNG;
13 @EXPORT = qw();
14
15 # ---------- BASE METHODS -------------
16
17 package Math::GSL::RNG;
18
19 sub TIEHASH {
20 my ($classname,$obj) = @_;
21 return bless $obj, $classname;
22 }
23
24 sub CLEAR { }
25
26 sub FIRSTKEY { }
27
28 sub NEXTKEY { }
29
30 sub FETCH {
31 my ($self,$field) = @_;
32 my $member_func = "swig_${field}_get";
33 $self->$member_func();
34 }
35
36 sub STORE {
37 my ($self,$field,$newval) = @_;
38 my $member_func = "swig_${field}_set";
39 $self->$member_func($newval);
40 }
41
42 sub this {
43 my $ptr = shift;
44 return tied(%$ptr);
45 }
46
47
48 # ------- FUNCTION WRAPPERS --------
49
50 package Math::GSL::RNG;
51
52 *gsl_error = *Math::GSL::RNGc::gsl_error;
53 *gsl_stream_printf = *Math::GSL::RNGc::gsl_stream_printf;
54 *gsl_strerror = *Math::GSL::RNGc::gsl_strerror;
55 *gsl_set_error_handler = *Math::GSL::RNGc::gsl_set_error_handler;
56 *gsl_set_error_handler_off = *Math::GSL::RNGc::gsl_set_error_handler_off;
57 *gsl_set_stream_handler = *Math::GSL::RNGc::gsl_set_stream_handler;
58 *gsl_set_stream = *Math::GSL::RNGc::gsl_set_stream;
59 *gsl_rng_types_setup = *Math::GSL::RNGc::gsl_rng_types_setup;
60 *gsl_rng_alloc = *Math::GSL::RNGc::gsl_rng_alloc;
61 *gsl_rng_memcpy = *Math::GSL::RNGc::gsl_rng_memcpy;
62 *gsl_rng_clone = *Math::GSL::RNGc::gsl_rng_clone;
63 *gsl_rng_free = *Math::GSL::RNGc::gsl_rng_free;
64 *gsl_rng_set = *Math::GSL::RNGc::gsl_rng_set;
65 *gsl_rng_max = *Math::GSL::RNGc::gsl_rng_max;
66 *gsl_rng_min = *Math::GSL::RNGc::gsl_rng_min;
67 *gsl_rng_name = *Math::GSL::RNGc::gsl_rng_name;
68 *gsl_rng_fread = *Math::GSL::RNGc::gsl_rng_fread;
69 *gsl_rng_fwrite = *Math::GSL::RNGc::gsl_rng_fwrite;
70 *gsl_rng_size = *Math::GSL::RNGc::gsl_rng_size;
71 *gsl_rng_state = *Math::GSL::RNGc::gsl_rng_state;
72 *gsl_rng_print_state = *Math::GSL::RNGc::gsl_rng_print_state;
73 *gsl_rng_env_setup = *Math::GSL::RNGc::gsl_rng_env_setup;
74 *gsl_rng_get = *Math::GSL::RNGc::gsl_rng_get;
75 *gsl_rng_uniform = *Math::GSL::RNGc::gsl_rng_uniform;
76 *gsl_rng_uniform_pos = *Math::GSL::RNGc::gsl_rng_uniform_pos;
77 *gsl_rng_uniform_int = *Math::GSL::RNGc::gsl_rng_uniform_int;
78
79 ############# Class : Math::GSL::RNG::gsl_rng_type ##############
80
81 package Math::GSL::RNG::gsl_rng_type;
82 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
83 @ISA = qw( Math::GSL::RNG );
84 %OWNER = ();
85 %ITERATORS = ();
86 *swig_name_get = *Math::GSL::RNGc::gsl_rng_type_name_get;
87 *swig_name_set = *Math::GSL::RNGc::gsl_rng_type_name_set;
88 *swig_max_get = *Math::GSL::RNGc::gsl_rng_type_max_get;
89 *swig_max_set = *Math::GSL::RNGc::gsl_rng_type_max_set;
90 *swig_min_get = *Math::GSL::RNGc::gsl_rng_type_min_get;
91 *swig_min_set = *Math::GSL::RNGc::gsl_rng_type_min_set;
92 *swig_size_get = *Math::GSL::RNGc::gsl_rng_type_size_get;
93 *swig_size_set = *Math::GSL::RNGc::gsl_rng_type_size_set;
94 *swig_set_get = *Math::GSL::RNGc::gsl_rng_type_set_get;
95 *swig_set_set = *Math::GSL::RNGc::gsl_rng_type_set_set;
96 *swig_get_get = *Math::GSL::RNGc::gsl_rng_type_get_get;
97 *swig_get_set = *Math::GSL::RNGc::gsl_rng_type_get_set;
98 *swig_get_double_get = *Math::GSL::RNGc::gsl_rng_type_get_double_get;
99 *swig_get_double_set = *Math::GSL::RNGc::gsl_rng_type_get_double_set;
100 sub new {
101 my $pkg = shift;
102 my $self = Math::GSL::RNGc::new_gsl_rng_type(@_);
103 bless $self, $pkg if defined($self);
104 }
105
106 sub DESTROY {
107 return unless $_[0]->isa('HASH');
108 my $self = tied(%{$_[0]});
109 return unless defined $self;
110 delete $ITERATORS{$self};
111 if (exists $OWNER{$self}) {
112 Math::GSL::RNGc::delete_gsl_rng_type($self);
113 delete $OWNER{$self};
114 }
115 }
116
117 sub DISOWN {
118 my $self = shift;
119 my $ptr = tied(%$self);
120 delete $OWNER{$ptr};
121 }
122
123 sub ACQUIRE {
124 my $self = shift;
125 my $ptr = tied(%$self);
126 $OWNER{$ptr} = 1;
127 }
128
129
130 ############# Class : Math::GSL::RNG::gsl_rng ##############
131
132 package Math::GSL::RNG::gsl_rng;
133 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
134 @ISA = qw( Math::GSL::RNG );
135 %OWNER = ();
136 %ITERATORS = ();
137 *swig_type_get = *Math::GSL::RNGc::gsl_rng_type_get;
138 *swig_type_set = *Math::GSL::RNGc::gsl_rng_type_set;
139 *swig_state_get = *Math::GSL::RNGc::gsl_rng_state_get;
140 *swig_state_set = *Math::GSL::RNGc::gsl_rng_state_set;
141 sub new {
142 my $pkg = shift;
143 my $self = Math::GSL::RNGc::new_gsl_rng(@_);
144 bless $self, $pkg if defined($self);
145 }
146
147 sub DESTROY {
148 return unless $_[0]->isa('HASH');
149 my $self = tied(%{$_[0]});
150 return unless defined $self;
151 delete $ITERATORS{$self};
152 if (exists $OWNER{$self}) {
153 Math::GSL::RNGc::delete_gsl_rng($self);
154 delete $OWNER{$self};
155 }
156 }
157
158 sub DISOWN {
159 my $self = shift;
160 my $ptr = tied(%$self);
161 delete $OWNER{$ptr};
162 }
163
164 sub ACQUIRE {
165 my $self = shift;
166 my $ptr = tied(%$self);
167 $OWNER{$ptr} = 1;
168 }
169
170
171 # ------- VARIABLE STUBS --------
172
173 package Math::GSL::RNG;
174
175 *GSL_VERSION = *Math::GSL::RNGc::GSL_VERSION;
176 *GSL_MAJOR_VERSION = *Math::GSL::RNGc::GSL_MAJOR_VERSION;
177 *GSL_MINOR_VERSION = *Math::GSL::RNGc::GSL_MINOR_VERSION;
178 *GSL_POSZERO = *Math::GSL::RNGc::GSL_POSZERO;
179 *GSL_NEGZERO = *Math::GSL::RNGc::GSL_NEGZERO;
180 *GSL_SUCCESS = *Math::GSL::RNGc::GSL_SUCCESS;
181 *GSL_FAILURE = *Math::GSL::RNGc::GSL_FAILURE;
182 *GSL_CONTINUE = *Math::GSL::RNGc::GSL_CONTINUE;
183 *GSL_EDOM = *Math::GSL::RNGc::GSL_EDOM;
184 *GSL_ERANGE = *Math::GSL::RNGc::GSL_ERANGE;
185 *GSL_EFAULT = *Math::GSL::RNGc::GSL_EFAULT;
186 *GSL_EINVAL = *Math::GSL::RNGc::GSL_EINVAL;
187 *GSL_EFAILED = *Math::GSL::RNGc::GSL_EFAILED;
188 *GSL_EFACTOR = *Math::GSL::RNGc::GSL_EFACTOR;
189 *GSL_ESANITY = *Math::GSL::RNGc::GSL_ESANITY;
190 *GSL_ENOMEM = *Math::GSL::RNGc::GSL_ENOMEM;
191 *GSL_EBADFUNC = *Math::GSL::RNGc::GSL_EBADFUNC;
192 *GSL_ERUNAWAY = *Math::GSL::RNGc::GSL_ERUNAWAY;
193 *GSL_EMAXITER = *Math::GSL::RNGc::GSL_EMAXITER;
194 *GSL_EZERODIV = *Math::GSL::RNGc::GSL_EZERODIV;
195 *GSL_EBADTOL = *Math::GSL::RNGc::GSL_EBADTOL;
196 *GSL_ETOL = *Math::GSL::RNGc::GSL_ETOL;
197 *GSL_EUNDRFLW = *Math::GSL::RNGc::GSL_EUNDRFLW;
198 *GSL_EOVRFLW = *Math::GSL::RNGc::GSL_EOVRFLW;
199 *GSL_ELOSS = *Math::GSL::RNGc::GSL_ELOSS;
200 *GSL_EROUND = *Math::GSL::RNGc::GSL_EROUND;
201 *GSL_EBADLEN = *Math::GSL::RNGc::GSL_EBADLEN;
202 *GSL_ENOTSQR = *Math::GSL::RNGc::GSL_ENOTSQR;
203 *GSL_ESING = *Math::GSL::RNGc::GSL_ESING;
204 *GSL_EDIVERGE = *Math::GSL::RNGc::GSL_EDIVERGE;
205 *GSL_EUNSUP = *Math::GSL::RNGc::GSL_EUNSUP;
206 *GSL_EUNIMPL = *Math::GSL::RNGc::GSL_EUNIMPL;
207 *GSL_ECACHE = *Math::GSL::RNGc::GSL_ECACHE;
208 *GSL_ETABLE = *Math::GSL::RNGc::GSL_ETABLE;
209 *GSL_ENOPROG = *Math::GSL::RNGc::GSL_ENOPROG;
210 *GSL_ENOPROGJ = *Math::GSL::RNGc::GSL_ENOPROGJ;
211 *GSL_ETOLF = *Math::GSL::RNGc::GSL_ETOLF;
212 *GSL_ETOLX = *Math::GSL::RNGc::GSL_ETOLX;
213 *GSL_ETOLG = *Math::GSL::RNGc::GSL_ETOLG;
214 *GSL_EOF = *Math::GSL::RNGc::GSL_EOF;
215
216 my %__gsl_rng_borosh13_hash;
217 tie %__gsl_rng_borosh13_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_borosh13;
218 $gsl_rng_borosh13= \%__gsl_rng_borosh13_hash;
219 bless $gsl_rng_borosh13, Math::GSL::RNG::gsl_rng_type;
220
221 my %__gsl_rng_coveyou_hash;
222 tie %__gsl_rng_coveyou_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_coveyou;
223 $gsl_rng_coveyou= \%__gsl_rng_coveyou_hash;
224 bless $gsl_rng_coveyou, Math::GSL::RNG::gsl_rng_type;
225
226 my %__gsl_rng_cmrg_hash;
227 tie %__gsl_rng_cmrg_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_cmrg;
228 $gsl_rng_cmrg= \%__gsl_rng_cmrg_hash;
229 bless $gsl_rng_cmrg, Math::GSL::RNG::gsl_rng_type;
230
231 my %__gsl_rng_fishman18_hash;
232 tie %__gsl_rng_fishman18_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_fishman18;
233 $gsl_rng_fishman18= \%__gsl_rng_fishman18_hash;
234 bless $gsl_rng_fishman18, Math::GSL::RNG::gsl_rng_type;
235
236 my %__gsl_rng_fishman20_hash;
237 tie %__gsl_rng_fishman20_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_fishman20;
238 $gsl_rng_fishman20= \%__gsl_rng_fishman20_hash;
239 bless $gsl_rng_fishman20, Math::GSL::RNG::gsl_rng_type;
240
241 my %__gsl_rng_fishman2x_hash;
242 tie %__gsl_rng_fishman2x_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_fishman2x;
243 $gsl_rng_fishman2x= \%__gsl_rng_fishman2x_hash;
244 bless $gsl_rng_fishman2x, Math::GSL::RNG::gsl_rng_type;
245
246 my %__gsl_rng_gfsr4_hash;
247 tie %__gsl_rng_gfsr4_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_gfsr4;
248 $gsl_rng_gfsr4= \%__gsl_rng_gfsr4_hash;
249 bless $gsl_rng_gfsr4, Math::GSL::RNG::gsl_rng_type;
250
251 my %__gsl_rng_knuthran_hash;
252 tie %__gsl_rng_knuthran_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_knuthran;
253 $gsl_rng_knuthran= \%__gsl_rng_knuthran_hash;
254 bless $gsl_rng_knuthran, Math::GSL::RNG::gsl_rng_type;
255
256 my %__gsl_rng_knuthran2_hash;
257 tie %__gsl_rng_knuthran2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_knuthran2;
258 $gsl_rng_knuthran2= \%__gsl_rng_knuthran2_hash;
259 bless $gsl_rng_knuthran2, Math::GSL::RNG::gsl_rng_type;
260
261 my %__gsl_rng_knuthran2002_hash;
262 tie %__gsl_rng_knuthran2002_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_knuthran2002;
263 $gsl_rng_knuthran2002= \%__gsl_rng_knuthran2002_hash;
264 bless $gsl_rng_knuthran2002, Math::GSL::RNG::gsl_rng_type;
265
266 my %__gsl_rng_lecuyer21_hash;
267 tie %__gsl_rng_lecuyer21_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_lecuyer21;
268 $gsl_rng_lecuyer21= \%__gsl_rng_lecuyer21_hash;
269 bless $gsl_rng_lecuyer21, Math::GSL::RNG::gsl_rng_type;
270
271 my %__gsl_rng_minstd_hash;
272 tie %__gsl_rng_minstd_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_minstd;
273 $gsl_rng_minstd= \%__gsl_rng_minstd_hash;
274 bless $gsl_rng_minstd, Math::GSL::RNG::gsl_rng_type;
275
276 my %__gsl_rng_mrg_hash;
277 tie %__gsl_rng_mrg_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_mrg;
278 $gsl_rng_mrg= \%__gsl_rng_mrg_hash;
279 bless $gsl_rng_mrg, Math::GSL::RNG::gsl_rng_type;
280
281 my %__gsl_rng_mt19937_hash;
282 tie %__gsl_rng_mt19937_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_mt19937;
283 $gsl_rng_mt19937= \%__gsl_rng_mt19937_hash;
284 bless $gsl_rng_mt19937, Math::GSL::RNG::gsl_rng_type;
285
286 my %__gsl_rng_mt19937_1999_hash;
287 tie %__gsl_rng_mt19937_1999_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_mt19937_1999;
288 $gsl_rng_mt19937_1999= \%__gsl_rng_mt19937_1999_hash;
289 bless $gsl_rng_mt19937_1999, Math::GSL::RNG::gsl_rng_type;
290
291 my %__gsl_rng_mt19937_1998_hash;
292 tie %__gsl_rng_mt19937_1998_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_mt19937_1998;
293 $gsl_rng_mt19937_1998= \%__gsl_rng_mt19937_1998_hash;
294 bless $gsl_rng_mt19937_1998, Math::GSL::RNG::gsl_rng_type;
295
296 my %__gsl_rng_r250_hash;
297 tie %__gsl_rng_r250_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_r250;
298 $gsl_rng_r250= \%__gsl_rng_r250_hash;
299 bless $gsl_rng_r250, Math::GSL::RNG::gsl_rng_type;
300
301 my %__gsl_rng_ran0_hash;
302 tie %__gsl_rng_ran0_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ran0;
303 $gsl_rng_ran0= \%__gsl_rng_ran0_hash;
304 bless $gsl_rng_ran0, Math::GSL::RNG::gsl_rng_type;
305
306 my %__gsl_rng_ran1_hash;
307 tie %__gsl_rng_ran1_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ran1;
308 $gsl_rng_ran1= \%__gsl_rng_ran1_hash;
309 bless $gsl_rng_ran1, Math::GSL::RNG::gsl_rng_type;
310
311 my %__gsl_rng_ran2_hash;
312 tie %__gsl_rng_ran2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ran2;
313 $gsl_rng_ran2= \%__gsl_rng_ran2_hash;
314 bless $gsl_rng_ran2, Math::GSL::RNG::gsl_rng_type;
315
316 my %__gsl_rng_ran3_hash;
317 tie %__gsl_rng_ran3_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ran3;
318 $gsl_rng_ran3= \%__gsl_rng_ran3_hash;
319 bless $gsl_rng_ran3, Math::GSL::RNG::gsl_rng_type;
320
321 my %__gsl_rng_rand_hash;
322 tie %__gsl_rng_rand_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_rand;
323 $gsl_rng_rand= \%__gsl_rng_rand_hash;
324 bless $gsl_rng_rand, Math::GSL::RNG::gsl_rng_type;
325
326 my %__gsl_rng_rand48_hash;
327 tie %__gsl_rng_rand48_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_rand48;
328 $gsl_rng_rand48= \%__gsl_rng_rand48_hash;
329 bless $gsl_rng_rand48, Math::GSL::RNG::gsl_rng_type;
330
331 my %__gsl_rng_random128_bsd_hash;
332 tie %__gsl_rng_random128_bsd_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random128_bsd;
333 $gsl_rng_random128_bsd= \%__gsl_rng_random128_bsd_hash;
334 bless $gsl_rng_random128_bsd, Math::GSL::RNG::gsl_rng_type;
335
336 my %__gsl_rng_random128_glibc2_hash;
337 tie %__gsl_rng_random128_glibc2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random128_glibc2;
338 $gsl_rng_random128_glibc2= \%__gsl_rng_random128_glibc2_hash;
339 bless $gsl_rng_random128_glibc2, Math::GSL::RNG::gsl_rng_type;
340
341 my %__gsl_rng_random128_libc5_hash;
342 tie %__gsl_rng_random128_libc5_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random128_libc5;
343 $gsl_rng_random128_libc5= \%__gsl_rng_random128_libc5_hash;
344 bless $gsl_rng_random128_libc5, Math::GSL::RNG::gsl_rng_type;
345
346 my %__gsl_rng_random256_bsd_hash;
347 tie %__gsl_rng_random256_bsd_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random256_bsd;
348 $gsl_rng_random256_bsd= \%__gsl_rng_random256_bsd_hash;
349 bless $gsl_rng_random256_bsd, Math::GSL::RNG::gsl_rng_type;
350
351 my %__gsl_rng_random256_glibc2_hash;
352 tie %__gsl_rng_random256_glibc2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random256_glibc2;
353 $gsl_rng_random256_glibc2= \%__gsl_rng_random256_glibc2_hash;
354 bless $gsl_rng_random256_glibc2, Math::GSL::RNG::gsl_rng_type;
355
356 my %__gsl_rng_random256_libc5_hash;
357 tie %__gsl_rng_random256_libc5_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random256_libc5;
358 $gsl_rng_random256_libc5= \%__gsl_rng_random256_libc5_hash;
359 bless $gsl_rng_random256_libc5, Math::GSL::RNG::gsl_rng_type;
360
361 my %__gsl_rng_random32_bsd_hash;
362 tie %__gsl_rng_random32_bsd_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random32_bsd;
363 $gsl_rng_random32_bsd= \%__gsl_rng_random32_bsd_hash;
364 bless $gsl_rng_random32_bsd, Math::GSL::RNG::gsl_rng_type;
365
366 my %__gsl_rng_random32_glibc2_hash;
367 tie %__gsl_rng_random32_glibc2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random32_glibc2;
368 $gsl_rng_random32_glibc2= \%__gsl_rng_random32_glibc2_hash;
369 bless $gsl_rng_random32_glibc2, Math::GSL::RNG::gsl_rng_type;
370
371 my %__gsl_rng_random32_libc5_hash;
372 tie %__gsl_rng_random32_libc5_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random32_libc5;
373 $gsl_rng_random32_libc5= \%__gsl_rng_random32_libc5_hash;
374 bless $gsl_rng_random32_libc5, Math::GSL::RNG::gsl_rng_type;
375
376 my %__gsl_rng_random64_bsd_hash;
377 tie %__gsl_rng_random64_bsd_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random64_bsd;
378 $gsl_rng_random64_bsd= \%__gsl_rng_random64_bsd_hash;
379 bless $gsl_rng_random64_bsd, Math::GSL::RNG::gsl_rng_type;
380
381 my %__gsl_rng_random64_glibc2_hash;
382 tie %__gsl_rng_random64_glibc2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random64_glibc2;
383 $gsl_rng_random64_glibc2= \%__gsl_rng_random64_glibc2_hash;
384 bless $gsl_rng_random64_glibc2, Math::GSL::RNG::gsl_rng_type;
385
386 my %__gsl_rng_random64_libc5_hash;
387 tie %__gsl_rng_random64_libc5_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random64_libc5;
388 $gsl_rng_random64_libc5= \%__gsl_rng_random64_libc5_hash;
389 bless $gsl_rng_random64_libc5, Math::GSL::RNG::gsl_rng_type;
390
391 my %__gsl_rng_random8_bsd_hash;
392 tie %__gsl_rng_random8_bsd_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random8_bsd;
393 $gsl_rng_random8_bsd= \%__gsl_rng_random8_bsd_hash;
394 bless $gsl_rng_random8_bsd, Math::GSL::RNG::gsl_rng_type;
395
396 my %__gsl_rng_random8_glibc2_hash;
397 tie %__gsl_rng_random8_glibc2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random8_glibc2;
398 $gsl_rng_random8_glibc2= \%__gsl_rng_random8_glibc2_hash;
399 bless $gsl_rng_random8_glibc2, Math::GSL::RNG::gsl_rng_type;
400
401 my %__gsl_rng_random8_libc5_hash;
402 tie %__gsl_rng_random8_libc5_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random8_libc5;
403 $gsl_rng_random8_libc5= \%__gsl_rng_random8_libc5_hash;
404 bless $gsl_rng_random8_libc5, Math::GSL::RNG::gsl_rng_type;
405
406 my %__gsl_rng_random_bsd_hash;
407 tie %__gsl_rng_random_bsd_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random_bsd;
408 $gsl_rng_random_bsd= \%__gsl_rng_random_bsd_hash;
409 bless $gsl_rng_random_bsd, Math::GSL::RNG::gsl_rng_type;
410
411 my %__gsl_rng_random_glibc2_hash;
412 tie %__gsl_rng_random_glibc2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random_glibc2;
413 $gsl_rng_random_glibc2= \%__gsl_rng_random_glibc2_hash;
414 bless $gsl_rng_random_glibc2, Math::GSL::RNG::gsl_rng_type;
415
416 my %__gsl_rng_random_libc5_hash;
417 tie %__gsl_rng_random_libc5_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_random_libc5;
418 $gsl_rng_random_libc5= \%__gsl_rng_random_libc5_hash;
419 bless $gsl_rng_random_libc5, Math::GSL::RNG::gsl_rng_type;
420
421 my %__gsl_rng_randu_hash;
422 tie %__gsl_rng_randu_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_randu;
423 $gsl_rng_randu= \%__gsl_rng_randu_hash;
424 bless $gsl_rng_randu, Math::GSL::RNG::gsl_rng_type;
425
426 my %__gsl_rng_ranf_hash;
427 tie %__gsl_rng_ranf_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranf;
428 $gsl_rng_ranf= \%__gsl_rng_ranf_hash;
429 bless $gsl_rng_ranf, Math::GSL::RNG::gsl_rng_type;
430
431 my %__gsl_rng_ranlux_hash;
432 tie %__gsl_rng_ranlux_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranlux;
433 $gsl_rng_ranlux= \%__gsl_rng_ranlux_hash;
434 bless $gsl_rng_ranlux, Math::GSL::RNG::gsl_rng_type;
435
436 my %__gsl_rng_ranlux389_hash;
437 tie %__gsl_rng_ranlux389_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranlux389;
438 $gsl_rng_ranlux389= \%__gsl_rng_ranlux389_hash;
439 bless $gsl_rng_ranlux389, Math::GSL::RNG::gsl_rng_type;
440
441 my %__gsl_rng_ranlxd1_hash;
442 tie %__gsl_rng_ranlxd1_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranlxd1;
443 $gsl_rng_ranlxd1= \%__gsl_rng_ranlxd1_hash;
444 bless $gsl_rng_ranlxd1, Math::GSL::RNG::gsl_rng_type;
445
446 my %__gsl_rng_ranlxd2_hash;
447 tie %__gsl_rng_ranlxd2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranlxd2;
448 $gsl_rng_ranlxd2= \%__gsl_rng_ranlxd2_hash;
449 bless $gsl_rng_ranlxd2, Math::GSL::RNG::gsl_rng_type;
450
451 my %__gsl_rng_ranlxs0_hash;
452 tie %__gsl_rng_ranlxs0_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranlxs0;
453 $gsl_rng_ranlxs0= \%__gsl_rng_ranlxs0_hash;
454 bless $gsl_rng_ranlxs0, Math::GSL::RNG::gsl_rng_type;
455
456 my %__gsl_rng_ranlxs1_hash;
457 tie %__gsl_rng_ranlxs1_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranlxs1;
458 $gsl_rng_ranlxs1= \%__gsl_rng_ranlxs1_hash;
459 bless $gsl_rng_ranlxs1, Math::GSL::RNG::gsl_rng_type;
460
461 my %__gsl_rng_ranlxs2_hash;
462 tie %__gsl_rng_ranlxs2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranlxs2;
463 $gsl_rng_ranlxs2= \%__gsl_rng_ranlxs2_hash;
464 bless $gsl_rng_ranlxs2, Math::GSL::RNG::gsl_rng_type;
465
466 my %__gsl_rng_ranmar_hash;
467 tie %__gsl_rng_ranmar_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_ranmar;
468 $gsl_rng_ranmar= \%__gsl_rng_ranmar_hash;
469 bless $gsl_rng_ranmar, Math::GSL::RNG::gsl_rng_type;
470
471 my %__gsl_rng_slatec_hash;
472 tie %__gsl_rng_slatec_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_slatec;
473 $gsl_rng_slatec= \%__gsl_rng_slatec_hash;
474 bless $gsl_rng_slatec, Math::GSL::RNG::gsl_rng_type;
475
476 my %__gsl_rng_taus_hash;
477 tie %__gsl_rng_taus_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_taus;
478 $gsl_rng_taus= \%__gsl_rng_taus_hash;
479 bless $gsl_rng_taus, Math::GSL::RNG::gsl_rng_type;
480
481 my %__gsl_rng_taus2_hash;
482 tie %__gsl_rng_taus2_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_taus2;
483 $gsl_rng_taus2= \%__gsl_rng_taus2_hash;
484 bless $gsl_rng_taus2, Math::GSL::RNG::gsl_rng_type;
485
486 my %__gsl_rng_taus113_hash;
487 tie %__gsl_rng_taus113_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_taus113;
488 $gsl_rng_taus113= \%__gsl_rng_taus113_hash;
489 bless $gsl_rng_taus113, Math::GSL::RNG::gsl_rng_type;
490
491 my %__gsl_rng_transputer_hash;
492 tie %__gsl_rng_transputer_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_transputer;
493 $gsl_rng_transputer= \%__gsl_rng_transputer_hash;
494 bless $gsl_rng_transputer, Math::GSL::RNG::gsl_rng_type;
495
496 my %__gsl_rng_tt800_hash;
497 tie %__gsl_rng_tt800_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_tt800;
498 $gsl_rng_tt800= \%__gsl_rng_tt800_hash;
499 bless $gsl_rng_tt800, Math::GSL::RNG::gsl_rng_type;
500
501 my %__gsl_rng_uni_hash;
502 tie %__gsl_rng_uni_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_uni;
503 $gsl_rng_uni= \%__gsl_rng_uni_hash;
504 bless $gsl_rng_uni, Math::GSL::RNG::gsl_rng_type;
505
506 my %__gsl_rng_uni32_hash;
507 tie %__gsl_rng_uni32_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_uni32;
508 $gsl_rng_uni32= \%__gsl_rng_uni32_hash;
509 bless $gsl_rng_uni32, Math::GSL::RNG::gsl_rng_type;
510
511 my %__gsl_rng_vax_hash;
512 tie %__gsl_rng_vax_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_vax;
513 $gsl_rng_vax= \%__gsl_rng_vax_hash;
514 bless $gsl_rng_vax, Math::GSL::RNG::gsl_rng_type;
515
516 my %__gsl_rng_waterman14_hash;
517 tie %__gsl_rng_waterman14_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_waterman14;
518 $gsl_rng_waterman14= \%__gsl_rng_waterman14_hash;
519 bless $gsl_rng_waterman14, Math::GSL::RNG::gsl_rng_type;
520
521 my %__gsl_rng_zuf_hash;
522 tie %__gsl_rng_zuf_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_zuf;
523 $gsl_rng_zuf= \%__gsl_rng_zuf_hash;
524 bless $gsl_rng_zuf, Math::GSL::RNG::gsl_rng_type;
525
526 my %__gsl_rng_default_hash;
527 tie %__gsl_rng_default_hash,"Math::GSL::RNG::gsl_rng_type", $Math::GSL::RNGc::gsl_rng_default;
528 $gsl_rng_default= \%__gsl_rng_default_hash;
529 bless $gsl_rng_default, Math::GSL::RNG::gsl_rng_type;
530 *gsl_rng_default_seed = *Math::GSL::RNGc::gsl_rng_default_seed;
531
532
533 use Carp;
534
535 @EXPORT_OK = qw/
536 gsl_rng_alloc gsl_rng_set gsl_rng_get gsl_rng_free gsl_rng_memcpy
537 gsl_rng_fwrite gsl_rng_fread gsl_rng_clone gsl_rng_max gsl_rng_min
538 gsl_rng_name gsl_rng_size gsl_rng_state gsl_rng_print_state gsl_rng_uniform gsl_rng_uniform_pos gsl_rng_uniform_int
539 $gsl_rng_default $gsl_rng_knuthran $gsl_rng_ran0 $gsl_rng_borosh13
540 $gsl_rng_coveyou $gsl_rng_cmrg $gsl_rng_fishman18 $gsl_rng_fishman20 $gsl_rng_fishman2x
541 $gsl_rng_gfsr4 $gsl_rng_knuthran $gsl_rng_knuthran2 $gsl_rng_knuthran2002 $gsl_rng_lecuyer21
542 $gsl_rng_minstd $gsl_rng_mrg $gsl_rng_mt19937 $gsl_rng_mt19937_1999 $gsl_rng_mt19937_1998
543 $gsl_rng_r250 $gsl_rng_ran0 $gsl_rng_ran1 $gsl_rng_ran2 $gsl_rng_ran3
544 $gsl_rng_rand $gsl_rng_rand48 $gsl_rng_random128_bsd $gsl_rng_random128_gli $gsl_rng_random128_lib
545 $gsl_rng_random256_bsd $gsl_rng_random256_gli $gsl_rng_random256_lib $gsl_rng_random32_bsd
546 $gsl_rng_random32_glib $gsl_rng_random32_libc $gsl_rng_random64_bsd $gsl_rng_random64_glib
547 $gsl_rng_random64_libc $gsl_rng_random8_bsd $gsl_rng_random8_glibc $gsl_rng_random8_libc5
548 $gsl_rng_random_bsd $gsl_rng_random_glibc2 $gsl_rng_random_libc5 $gsl_rng_randu
549 $gsl_rng_ranf $gsl_rng_ranlux $gsl_rng_ranlux389 $gsl_rng_ranlxd1 $gsl_rng_ranlxd2 $gsl_rng_ranlxs0
550 $gsl_rng_ranlxs1 $gsl_rng_ranlxs2 $gsl_rng_ranmar $gsl_rng_slatec $gsl_rng_taus $gsl_rng_taus2
551 $gsl_rng_taus113 $gsl_rng_transputer $gsl_rng_tt800 $gsl_rng_uni $gsl_rng_uni32 $gsl_rng_vax
552 $gsl_rng_waterman14 $gsl_rng_zuf
553 /;
554 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
555
556 =encoding utf8
557
558 =head1 NAME
559
560 Math::GSL::RNG - Random Number Generators
561
562 =head1 SYNOPSIS
563
564 use Math::GSL::RNG;
565 my $rng = Math::GSL::RNG->new;
566 my @random = $rng->get(100);
567
568 =head1 Object Oriented Interface
569
570 =head2 Math::GSL::RNG->new($type, $seed)
571
572 my $rng = Math::GSL::RNG->new;
573 my $rng = Math::GSL::RNG->new($gsl_rng_knuthran,5);
574
575 Creates a new RNG object of type $type, seeded with $seed. Both of these
576 parameters are optional. The type $gsl_rng_default is used when no $type
577 is given.
578
579 =cut
580
581 sub new {
582 my ($class, $type, $seed) = @_;
583 $type ||= $gsl_rng_default;
584 $seed ||= int 100*rand;
585
586 my $self = {};
587 my $rng = gsl_rng_alloc($type);
588 gsl_rng_set($rng, $seed);
589
590 $self->{_rng} = $rng;
591 bless $self, $class;
592 }
593
594 =head2 copy()
595
596 my $copy = $rng->copy;
597
598 Make a copy of a RNG object.
599
600 =cut
601
602 sub copy {
603 my ($self) = @_;
604 my $copy = Math::GSL::RNG->new;
605 $copy->{_rng} = gsl_rng_clone($self->{_rng});
606
607 return $copy;
608 }
609
610 =head2 free()
611
612 $rng->free();
613
614 Free memory associated with RNG object.
615
616 =cut
617
618 sub free {
619 my ($self) = @_;
620 gsl_rng_free($self->{_rng});
621 }
622
623 =head2 name()
624
625 my $name = $rng->name();
626
627 Get the name of the RNG object as a string.
628
629 =cut
630
631 sub name {
632 my ($self) = @_;
633 gsl_rng_name($self->{_rng});
634 }
635
636 =head2 get()
637
638 my $nextval = $rng->get;
639 my (@values) = $rng->get(100);
640
641 Get the next random value from the RNG object. If given an integer N, returns the next N values.
642
643 =cut
644
645 sub get {
646 my ($self, $num_values) = @_;
647 $num_values ||= 1;
648
649 return map { gsl_rng_get($self->{_rng}) } (1 .. $num_values);
650 }
651
652 =head2 raw()
653
654 my $raw = $rng->raw();
655
656 Return the raw GSL RNG object, useful for functions which take a RNG,
657 such as the Monte Carlo integration functions or the random number
658 distribution functions in Math::GSL::Randist.
659
660 =cut
661
662 sub raw {
663 my $self = shift;
664 return $self->{_rng};
665 }
666
667 =head2 shuffle()
668
669 my @array = $rng->shuffle(@other_array);
670
671 Given a RNG, shuffle an array.
672
673 =cut
674
675 sub shuffle {
676 my ($self, @array) = @_;
677
678 my $nr_elements = $#array;
679 my $output = Math::GSL::Randist::our_gsl_ran_shuffle($self->raw,
680 [0..$nr_elements],
681 $nr_elements + 1);
682 return map { $array[$_] } @$output;
683 }
684
685 =head2 choose()
686
687 my @array = $rng->choose(4, @other_array);
688
689 This function fills the destination array with k objects taken
690 randomly from the n elements of the array argument. The objects are
691 sampled without replacement, thus each object can only appear once in
692 destination array. It is required that k be less than or equal to n.
693
694 =cut
695
696 sub choose {
697 my ($self, $k, @array) = @_;
698
699 my $nr_elements = $#array;
700 croak __PACKAGE__, "- choose method called with k greater than number of elements in the array"
701 if $k > $nr_elements + 1;
702
703 my $output = Math::GSL::Randist::our_gsl_ran_choose($self->raw, $k,
704 [0..$nr_elements],
705 $nr_elements + 1);
706 return map { $array[$_] } @$output;
707 }
708
709
710 =head2 sample()
711
712 my @array = $rng->sample(4, @other_array);
713
714 This method is like C<choose> but samples k items from the original
715 array of n items src with replacement, so the same object can appear
716 more than once in the output sequence dest. There is no requirement
717 that k be less than n in this case.
718
719 =cut
720
721 sub sample {
722 my ($self, $k, @array) = @_;
723
724 my $nr_elements = $#array;
725
726 my $output = Math::GSL::Randist::our_gsl_ran_sample($self->raw, $k,
727 [0..$nr_elements],
728 $nr_elements + 1);
729 return map { $array[$_] } @$output;
730 }
731
732
733 __END__
734
735
736 =head1 GSL API Interface
737
738 =over 1
739
740 =item gsl_rng_alloc($T) - This function returns a pointer to a newly-created instance of a random number generator of type $T. $T must be one of the constants below. The generator is automatically initialized with the default seed, $gsl_rng_default.
741
742 =item gsl_rng_set($r, $s) - This function initializes (or `seeds') the random number generator. If the generator is seeded with the same value of $s on two different runs, the same stream of random numbers will be generated by successive calls to the routines below. If different values of $s are supplied, then the generated streams of random numbers should be completely different. If the seed $s is zero then the standard seed from the original implementation is used instead. For example, the original Fortran source code for the ranlux generator used a seed of 314159265, and so choosing $s equal to zero reproduces this when using $gsl_rng_ranlux.
743
744 =item gsl_rng_get($r) - This function returns a random integer from the generator $r. The minimum and maximum values depend on the algorithm used, but all integers in the range [min,max] are equally likely. The values of min and max can determined using the auxiliary functions gsl_rng_max($r) and gsl_rng_min($r).
745
746 =item gsl_rng_free($r) - This function frees all the memory associated with the generator $r.
747
748 =item gsl_rng_memcpy($dest, $src) - This function copies the random number generator $src into the pre-existing generator $dest, making $dest into an exact copy of $src. The two generators must be of the same type.
749
750 =item gsl_rng_uniform($r) - This function returns a double precision floating point number uniformly distributed in the range [0,1). The range includes 0.0 but excludes 1.0. The value is typically obtained by dividing the result of gsl_rng_get($r) by gsl_rng_max($r) + 1.0 in double precision. Some generators compute this ratio internally so that they can provide floating point numbers with more than 32 bits of randomness (the maximum number of bits that can be portably represented in a single unsigned long int).
751
752 =item gsl_rng_uniform_pos($r) - This function returns a positive double precision floating point number uniformly distributed in the range (0,1), excluding both 0.0 and 1.0. The number is obtained by sampling the generator with the algorithm of gsl_rng_uniform until a non-zero value is obtained. You can use this function if you need to avoid a singularity at 0.0.
753
754 =item gsl_rng_uniform_int($r, $n) - This function returns a random integer from 0 to $n-1 inclusive by scaling down and/or discarding samples from the generator $r. All integers in the range [0,$n-1] are produced with equal probability. For generators with a non-zero minimum value an offset is applied so that zero is returned with the correct probability. Note that this function is designed for sampling from ranges smaller than the range of the underlying generator. The parameter $n must be less than or equal to the range of the generator $r. If $n is larger than the range of the generator then the function calls the error handler with an error code of $GSL_EINVAL and returns zero. In particular, this function is not intended for generating the full range of unsigned integer values [0,2^32-1]. Instead choose a generator with the maximal integer range and zero mimimum value, such as $gsl_rng_ranlxd1, $gsl_rng_mt19937 or $gsl_rng_taus, and sample it directly using gsl_rng_get. The range of each generator can be found using the auxiliary functions described in the next section.
755
756 =item gsl_rng_fwrite($stream, $r) - This function writes the random number state of the random number generator $r to the stream $stream (opened with the gsl_fopen function from the Math::GSL module) in binary format. The return value is 0 for success and $GSL_EFAILED if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures.
757
758 =item gsl_rng_fread($stream, $r) - This function reads the random number state into the random number generator $r from the open stream $stream (opened with the gsl_fopen function from the Math::GSL module) in binary format. The random number generator $r must be preinitialized with the correct random number generator type since type information is not saved. The return value is 0 for success and $GSL_EFAILED if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture.
759
760 =item gsl_rng_clone($r) - This function returns a pointer to a newly created generator which is an exact copy of the generator $r.
761
762 =item gsl_rng_max($r) - This function returns the largest value that gsl_rng_get can return.
763
764 =item gsl_rng_min($r) - gsl_rng_min returns the smallest value that gsl_rng_get can return. Usually this value is zero. There are some generators with algorithms that cannot return zero, and for these generators the minimum value is 1.
765
766 =item gsl_rng_name($r) - This function returns a pointer to the name of the generator. For example,
767
768 =over
769
770 =item print "r is a " . gsl_rng_name($r) . "generator\n";
771
772 =item would print something like r is a 'taus' generator.
773
774 =back
775
776 =item gsl_rng_size($r) - This function returns the size of the state of generator $r. You can use this information to access the state directly.
777
778 =item gsl_rng_state($r) - This function returns a pointer to the state of generator $r. You can use this information to access the state directly.
779
780 =item gsl_rng_print_state($r)
781
782 =back
783
784 =head1 Random Number Generator Types
785
786 =over 1
787
788 =item $gsl_rng_default
789
790 =item $gsl_rng_knuthran
791
792 =item $gsl_rng_ran0
793
794 =item $gsl_rng_borosh13
795
796 =item $gsl_rng_coveyou
797
798 =item $gsl_rng_cmrg
799
800 =item $gsl_rng_fishman18
801
802 =item $gsl_rng_fishman20
803
804 =item $gsl_rng_fishman2x - This is the L'Ecuyer-Fishman random number generator. It is taken from Knuth's Seminumerical Algorithms, 3rd Ed., page 108. Its sequence is, z_{n+1} = (x_n - y_n) mod m with m = 2^31 - 1. x_n and y_n are given by the fishman20 and lecuyer21 algorithms. The seed specifies the initial value, x_1.
805
806 =item $gsl_rng_gfsr4
807
808 =item $gsl_rng_knuthran
809
810 =item $gsl_rng_knuthran2
811
812 =item $gsl_rng_knuthran2002
813
814 =item $gsl_rng_lecuyer21
815
816 =item $gsl_rng_minstd
817
818 =item $gsl_rng_mrg
819
820 =item $gsl_rng_mt19937
821
822 =item $gsl_rng_mt19937_1999
823
824 =item $gsl_rng_mt19937_1998
825
826 =item $gsl_rng_r250
827
828 =item $gsl_rng_ran0
829
830 =item $gsl_rng_ran1
831
832 =item $gsl_rng_ran2
833
834 =item $gsl_rng_ran3
835
836 =item $gsl_rng_rand - This is the BSD rand generator. Its sequence is x_{n+1} = (a x_n + c) mod m with a = 1103515245, c = 12345 and m = 2^31. The seed specifies the initial value, x_1. The period of this generator is 2^31, and it uses 1 word of storage per generator.
837
838 =item $gsl_rng_rand48
839
840 =item $gsl_rng_random128_bsd
841
842 =item $gsl_rng_random128_gli
843
844 =item $gsl_rng_random128_lib
845
846 =item $gsl_rng_random256_bsd
847
848 =item $gsl_rng_random256_gli
849
850 =item $gsl_rng_random256_lib
851
852 =item $gsl_rng_random32_bsd
853
854 =item $gsl_rng_random32_glib
855
856 =item $gsl_rng_random32_libc
857
858 =item $gsl_rng_random64_bsd
859
860 =item $gsl_rng_random64_glib
861
862 =item $gsl_rng_random64_libc
863
864 =item $gsl_rng_random8_bsd
865
866 =item $gsl_rng_random8_glibc
867
868 =item $gsl_rng_random8_libc5
869
870 =item $gsl_rng_random_bsd
871
872 =item $gsl_rng_random_glibc2
873
874 =item $gsl_rng_random_libc5
875
876 =item $gsl_rng_randu
877
878 =item $gsl_rng_ranf
879
880 =item $gsl_rng_ranlux
881
882 =item $gsl_rng_ranlux389
883
884 =item $gsl_rng_ranlxd1
885
886 =item $gsl_rng_ranlxd2
887
888 =item $gsl_rng_ranlxs0
889
890 =item $gsl_rng_ranlxs1
891
892 =item $gsl_rng_ranlxs2
893
894 =item $gsl_rng_ranmar - This is the RANMAR lagged-fibonacci generator of Marsaglia, Zaman and Tsang. It is a 24-bit generator, originally designed for single-precision IEEE floating point numbers. It was included in the CERNLIB high-energy physics library.
895
896 =item $gsl_rng_slatec - This is the SLATEC random number generator RAND. It is ancient. The original source code is available from NETLIB.
897
898 =item $gsl_rng_taus
899
900 =item $gsl_rng_taus2
901
902 =item $gsl_rng_taus113
903
904 =item $gsl_rng_transputer
905
906 =item $gsl_rng_tt800
907
908 =item $gsl_rng_uni
909
910 =item $gsl_rng_uni32
911
912 =item $gsl_rng_vax - This is the VAX generator MTH$RANDOM. Its sequence is, x_{n+1} = (a x_n + c) mod m with a = 69069, c = 1 and m = 2^32. The seed specifies the initial value, x_1. The period of this generator is 2^32 and it uses 1 word of storage per generator.
913
914 =item $gsl_rng_waterman14
915
916 =item $gsl_rng_zuf - This is the ZUFALL lagged Fibonacci series generator of Peterson. Its sequence is,
917
918 =over
919
920 =item t = u_{n-273} + u_{n-607}
921
922 =item u_n = t - floor(t)
923
924 =back
925
926 The original source code is available from NETLIB. For more information see,
927
928 * W. Petersen, “Lagged Fibonacci Random Number Generators for the NEC SX-3”, International Journal of High Speed Computing (1994).
929
930 =back
931
932 For more informations on the functions, we refer you to the GSL official documentation:
933
934 L<http://www.gnu.org/software/gsl/manual/html_node/>
935
936
937
938 =head1 EXAMPLES
939
940 The following example will print out a list a random integers between certain
941 minimum and maximum values. The command line arguments are first the number of
942 random numbers wanted, the minimum and then maximum. The defaults are 10, 0 and
943 100, respectively.
944
945 use Math::GSL::RNG qw/:all/;
946 my $seed = int rand(100);
947 my $rng = Math::GSL::RNG->new($gsl_rng_knuthran, $seed );
948 my ($num,$min,$max) = @ARGV;
949 $num ||= 10;
950 $min ||= 0;
951 $max ||= 100;
952 print join "\n", map { $min + $rng->get % ($max-$min+1) } (1..$num);
953 print "\n";
954
955 The C<$seed> argument is optional but encouraged. This program is available in
956 the B<examples/> directory that comes with the source of this module.
957
958 If you would like a series of random non-integer numbers, then you can generate one "scaling factor"
959 and multiple by that, such as
960
961 use Math::GSL::RNG qw/:all/;
962 my $scale= rand(10);
963 my $seed = int rand(100);
964 my $rng = Math::GSL::RNG->new($gsl_rng_knuthran, $seed );
965 my ($num,$min,$max) = (10,0,100);
966 print join "\n", map { $scale*($min + $rng->get % ($max-$min+1)) } (1..$num);
967 print "\n";
968
969 =head1 AUTHORS
970
971 Jonathan "Duke" Leto <[email protected]> and Thierry Moisan <[email protected]>
972
973 =head1 COPYRIGHT AND LICENSE
974
975 Copyright (C) 2008-2024 Jonathan "Duke" Leto and Thierry Moisan
976
977 This program is free software; you can redistribute it and/or modify it
978 under the same terms as Perl itself.
979
980 =cut
981
982 1;