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 set p [::simulation::random::prng_Normal -1.0 10.0]
58
59 produces a new command (whose name is stored in the variable "p") that
60 generates normally distributed numbers with a mean of -1.0 and a stan‐
61 dard deviation of 10.0.
62
64 The package defines the following public procedures for discrete dis‐
65 tributions:
66
67 ::simulation::random::prng_Bernoulli p
68 Create a command (PRNG) that generates numbers with a Bernoulli
69 distribution: the value is either 1 or 0, with a chance p to be
70 1
71
72 float p
73 Chance the outcome is 1
74
75
76 ::simulation::random::prng_Discrete n
77 Create a command (PRNG) that generates numbers 0 to n-1 with
78 equal probability.
79
80 int n Number of different values (ranging from 0 to n-1)
81
82
83 ::simulation::random::prng_Poisson lambda
84 Create a command (PRNG) that generates numbers according to the
85 Poisson distribution.
86
87 float lambda
88 Mean number per time interval
89
90 The package defines the following public procedures for continuous dis‐
91 tributions:
92
93 ::simulation::random::prng_Uniform min max
94 Create a command (PRNG) that generates uniformly distributed
95 numbers between "min" and "max".
96
97 float min
98 Minimum number that will be generated
99
100 float max
101 Maximum number that will be generated
102
103
104 ::simulation::random::prng_Exponential min mean
105 Create a command (PRNG) that generates exponentially distributed
106 numbers with a given minimum value and a given mean value.
107
108 float min
109 Minimum number that will be generated
110
111 float mean
112 Mean value for the numbers
113
114
115 ::simulation::random::prng_Normal mean stdev
116 Create a command (PRNG) that generates normally distributed num‐
117 bers with a given mean value and a given standard deviation.
118
119 float mean
120 Mean value for the numbers
121
122 float stdev
123 Standard deviation
124
125
126 ::simulation::random::prng_Pareto min steep
127 Create a command (PRNG) that generates numbers distributed
128 according to Pareto with a given minimum value and a given dis‐
129 tribution steepness.
130
131 float min
132 Minimum number that will be generated
133
134 float steep
135 Steepness of the distribution
136
137
138 ::simulation::random::prng_Gumbel min f
139 Create a command (PRNG) that generates numbers distributed
140 according to Gumbel with a given minimum value and a given scale
141 factor. The probability density function is:
142
143 P(v) = exp( -exp(f*(v-min)))
144
145
146 float min
147 Minimum number that will be generated
148
149 float f
150 Scale factor for the values
151
152
153 ::simulation::random::prng_chiSquared df
154 Create a command (PRNG) that generates numbers distributed
155 according to the chi-squared distribution with df degrees of
156 freedom. The mean is 0 and the standard deviation is 1.
157
158 float df
159 Degrees of freedom
160
161 The package defines the following public procedures for random point
162 sets:
163
164 ::simulation::random::prng_Disk rad
165 Create a command (PRNG) that generates (x,y)-coordinates for
166 points uniformly spread over a disk of given radius.
167
168 float rad
169 Radius of the disk
170
171
172 ::simulation::random::prng_Sphere rad
173 Create a command (PRNG) that generates (x,y,z)-coordinates for
174 points uniformly spread over the surface of a sphere of given
175 radius.
176
177 float rad
178 Radius of the disk
179
180
181 ::simulation::random::prng_Ball rad
182 Create a command (PRNG) that generates (x,y,z)-coordinates for
183 points uniformly spread within a ball of given radius.
184
185 float rad
186 Radius of the ball
187
188
189 ::simulation::random::prng_Rectangle length width
190 Create a command (PRNG) that generates (x,y)-coordinates for
191 points uniformly spread over a rectangle.
192
193 float length
194 Length of the rectangle (x-direction)
195
196 float width
197 Width of the rectangle (y-direction)
198
199
200 ::simulation::random::prng_Block length width depth
201 Create a command (PRNG) that generates (x,y)-coordinates for
202 points uniformly spread over a block
203
204 float length
205 Length of the block (x-direction)
206
207 float width
208 Width of the block (y-direction)
209
210 float depth
211 Depth of the block (z-direction)
212
214 math, random numbers, simulation, statistical distribution
215
217 Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net>
218
219
220
221
222simulation 0.1 simulation::random(n)