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.4
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_Triangular min max
24
25 ::simulation::random::prng_SymmTriangular min max
26
27 ::simulation::random::prng_Exponential min mean
28
29 ::simulation::random::prng_Normal mean stdev
30
31 ::simulation::random::prng_Pareto min steep
32
33 ::simulation::random::prng_Gumbel min f
34
35 ::simulation::random::prng_chiSquared df
36
37 ::simulation::random::prng_Disk rad
38
39 ::simulation::random::prng_Sphere rad
40
41 ::simulation::random::prng_Ball rad
42
43 ::simulation::random::prng_Rectangle length width
44
45 ::simulation::random::prng_Block length width depth
46
47______________________________________________________________________________
48
50 This package consists of commands to generate pseudo-random number gen‐
51 erators. These new commands deliver
52
53 • numbers that are distributed normally, uniformly, according to a
54 Pareto or Gumbel distribution and so on
55
56 • coordinates of points uniformly spread inside a sphere or a rec‐
57 tangle
58
59 For example:
60
61
62 set p [::simulation::random::prng_Normal -1.0 10.0]
63
64 produces a new command (whose name is stored in the variable "p") that
65 generates normally distributed numbers with a mean of -1.0 and a stan‐
66 dard deviation of 10.0.
67
69 The package defines the following public procedures for discrete dis‐
70 tributions:
71
72 ::simulation::random::prng_Bernoulli p
73 Create a command (PRNG) that generates numbers with a Bernoulli
74 distribution: the value is either 1 or 0, with a chance p to be
75 1
76
77 float p
78 Chance the outcome is 1
79
80
81 ::simulation::random::prng_Discrete n
82 Create a command (PRNG) that generates numbers 0 to n-1 with
83 equal probability.
84
85 int n Number of different values (ranging from 0 to n-1)
86
87
88 ::simulation::random::prng_Poisson lambda
89 Create a command (PRNG) that generates numbers according to the
90 Poisson distribution.
91
92 float lambda
93 Mean number per time interval
94
95 The package defines the following public procedures for continuous dis‐
96 tributions:
97
98 ::simulation::random::prng_Uniform min max
99 Create a command (PRNG) that generates uniformly distributed
100 numbers between "min" and "max".
101
102 float min
103 Minimum number that will be generated
104
105 float max
106 Maximum number that will be generated
107
108
109 ::simulation::random::prng_Triangular min max
110 Create a command (PRNG) that generates triangularly distributed
111 numbers between "min" and "max". If the argument min is lower
112 than the argument max, then smaller values have higher probabil‐
113 ity and vice versa. In the first case the probability density
114 function is of the form f(x) = 2(1-x) and the other case it is
115 of the form f(x) = 2x.
116
117 float min
118 Minimum number that will be generated
119
120 float max
121 Maximum number that will be generated
122
123
124 ::simulation::random::prng_SymmTriangular min max
125 Create a command (PRNG) that generates numbers distributed ac‐
126 cording to a symmetric triangle around the mean of "min" and
127 "max".
128
129 float min
130 Minimum number that will be generated
131
132 float max
133 Maximum number that will be generated
134
135
136 ::simulation::random::prng_Exponential min mean
137 Create a command (PRNG) that generates exponentially distributed
138 numbers with a given minimum value and a given mean value.
139
140 float min
141 Minimum number that will be generated
142
143 float mean
144 Mean value for the numbers
145
146
147 ::simulation::random::prng_Normal mean stdev
148 Create a command (PRNG) that generates normally distributed num‐
149 bers with a given mean value and a given standard deviation.
150
151 float mean
152 Mean value for the numbers
153
154 float stdev
155 Standard deviation
156
157
158 ::simulation::random::prng_Pareto min steep
159 Create a command (PRNG) that generates numbers distributed ac‐
160 cording to Pareto with a given minimum value and a given distri‐
161 bution steepness.
162
163 float min
164 Minimum number that will be generated
165
166 float steep
167 Steepness of the distribution
168
169
170 ::simulation::random::prng_Gumbel min f
171 Create a command (PRNG) that generates numbers distributed ac‐
172 cording to Gumbel with a given minimum value and a given scale
173 factor. The probability density function is:
174
175
176 P(v) = exp( -exp(f*(v-min)))
177
178
179 float min
180 Minimum number that will be generated
181
182 float f
183 Scale factor for the values
184
185
186 ::simulation::random::prng_chiSquared df
187 Create a command (PRNG) that generates numbers distributed ac‐
188 cording to the chi-squared distribution with df degrees of free‐
189 dom. The mean is 0 and the standard deviation is 1.
190
191 float df
192 Degrees of freedom
193
194 The package defines the following public procedures for random point
195 sets:
196
197 ::simulation::random::prng_Disk rad
198 Create a command (PRNG) that generates (x,y)-coordinates for
199 points uniformly spread over a disk of given radius.
200
201 float rad
202 Radius of the disk
203
204
205 ::simulation::random::prng_Sphere rad
206 Create a command (PRNG) that generates (x,y,z)-coordinates for
207 points uniformly spread over the surface of a sphere of given
208 radius.
209
210 float rad
211 Radius of the disk
212
213
214 ::simulation::random::prng_Ball rad
215 Create a command (PRNG) that generates (x,y,z)-coordinates for
216 points uniformly spread within a ball of given radius.
217
218 float rad
219 Radius of the ball
220
221
222 ::simulation::random::prng_Rectangle length width
223 Create a command (PRNG) that generates (x,y)-coordinates for
224 points uniformly spread over a rectangle.
225
226 float length
227 Length of the rectangle (x-direction)
228
229 float width
230 Width of the rectangle (y-direction)
231
232
233 ::simulation::random::prng_Block length width depth
234 Create a command (PRNG) that generates (x,y,z)-coordinates for
235 points uniformly spread over a block
236
237 float length
238 Length of the block (x-direction)
239
240 float width
241 Width of the block (y-direction)
242
243 float depth
244 Depth of the block (z-direction)
245
247 math, random numbers, simulation, statistical distribution
248
250 Mathematics
251
253 Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net>
254
255
256
257
258tcllib 0.4 simulation::random(n)