1simulation::random(n) Tcl Simulation Tools simulation::random(n)
2
3
4
5______________________________________________________________________________
6
8 simulation::random - Pseudo-random number generators
9
11 package require Tcl ?8.4?
12
13 package require simulation::random 0.1
14
15 ::simulation::random::prng_Bernoulli p
16
17 ::simulation::random::prng_Discrete n
18
19 ::simulation::random::prng_Poisson lambda
20
21 ::simulation::random::prng_Uniform min max
22
23 ::simulation::random::prng_Exponential min mean
24
25 ::simulation::random::prng_Normal mean stdev
26
27 ::simulation::random::prng_Pareto min steep
28
29 ::simulation::random::prng_Gumbel min f
30
31 ::simulation::random::prng_chiSquared df
32
33 ::simulation::random::prng_Disk rad
34
35 ::simulation::random::prng_Sphere rad
36
37 ::simulation::random::prng_Ball rad
38
39 ::simulation::random::prng_Rectangle length width
40
41 ::simulation::random::prng_Block length width depth
42
43______________________________________________________________________________
44
46 This package consists of commands to generate pseudo-random number gen‐
47 erators. These new commands deliver
48
49 · numbers that are distributed normally, uniformly, according to a
50 Pareto or Gumbel distribution and so on
51
52 · coordinates of points uniformly spread inside a sphere or a rec‐
53 tangle
54
55 For example:
56
57
58 set p [::simulation::random::prng_Normal -1.0 10.0]
59
60 produces a new command (whose name is stored in the variable "p") that
61 generates normally distributed numbers with a mean of -1.0 and a stan‐
62 dard deviation of 10.0.
63
65 The package defines the following public procedures for discrete dis‐
66 tributions:
67
68 ::simulation::random::prng_Bernoulli p
69 Create a command (PRNG) that generates numbers with a Bernoulli
70 distribution: the value is either 1 or 0, with a chance p to be
71 1
72
73 float p
74 Chance the outcome is 1
75
76
77 ::simulation::random::prng_Discrete n
78 Create a command (PRNG) that generates numbers 0 to n-1 with
79 equal probability.
80
81 int n Number of different values (ranging from 0 to n-1)
82
83
84 ::simulation::random::prng_Poisson lambda
85 Create a command (PRNG) that generates numbers according to the
86 Poisson distribution.
87
88 float lambda
89 Mean number per time interval
90
91 The package defines the following public procedures for continuous dis‐
92 tributions:
93
94 ::simulation::random::prng_Uniform min max
95 Create a command (PRNG) that generates uniformly distributed
96 numbers between "min" and "max".
97
98 float min
99 Minimum number that will be generated
100
101 float max
102 Maximum number that will be generated
103
104
105 ::simulation::random::prng_Exponential min mean
106 Create a command (PRNG) that generates exponentially distributed
107 numbers with a given minimum value and a given mean value.
108
109 float min
110 Minimum number that will be generated
111
112 float mean
113 Mean value for the numbers
114
115
116 ::simulation::random::prng_Normal mean stdev
117 Create a command (PRNG) that generates normally distributed num‐
118 bers with a given mean value and a given standard deviation.
119
120 float mean
121 Mean value for the numbers
122
123 float stdev
124 Standard deviation
125
126
127 ::simulation::random::prng_Pareto min steep
128 Create a command (PRNG) that generates numbers distributed
129 according to Pareto with a given minimum value and a given dis‐
130 tribution steepness.
131
132 float min
133 Minimum number that will be generated
134
135 float steep
136 Steepness of the distribution
137
138
139 ::simulation::random::prng_Gumbel min f
140 Create a command (PRNG) that generates numbers distributed
141 according to Gumbel with a given minimum value and a given scale
142 factor. The probability density function is:
143
144
145 P(v) = exp( -exp(f*(v-min)))
146
147
148 float min
149 Minimum number that will be generated
150
151 float f
152 Scale factor for the values
153
154
155 ::simulation::random::prng_chiSquared df
156 Create a command (PRNG) that generates numbers distributed
157 according to the chi-squared distribution with df degrees of
158 freedom. The mean is 0 and the standard deviation is 1.
159
160 float df
161 Degrees of freedom
162
163 The package defines the following public procedures for random point
164 sets:
165
166 ::simulation::random::prng_Disk rad
167 Create a command (PRNG) that generates (x,y)-coordinates for
168 points uniformly spread over a disk of given radius.
169
170 float rad
171 Radius of the disk
172
173
174 ::simulation::random::prng_Sphere rad
175 Create a command (PRNG) that generates (x,y,z)-coordinates for
176 points uniformly spread over the surface of a sphere of given
177 radius.
178
179 float rad
180 Radius of the disk
181
182
183 ::simulation::random::prng_Ball rad
184 Create a command (PRNG) that generates (x,y,z)-coordinates for
185 points uniformly spread within a ball of given radius.
186
187 float rad
188 Radius of the ball
189
190
191 ::simulation::random::prng_Rectangle length width
192 Create a command (PRNG) that generates (x,y)-coordinates for
193 points uniformly spread over a rectangle.
194
195 float length
196 Length of the rectangle (x-direction)
197
198 float width
199 Width of the rectangle (y-direction)
200
201
202 ::simulation::random::prng_Block length width depth
203 Create a command (PRNG) that generates (x,y,z)-coordinates for
204 points uniformly spread over a block
205
206 float length
207 Length of the block (x-direction)
208
209 float width
210 Width of the block (y-direction)
211
212 float depth
213 Depth of the block (z-direction)
214
216 math, random numbers, simulation, statistical distribution
217
219 Mathematics
220
222 Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net>
223
224
225
226
227tcllib 0.1 simulation::random(n)