simulation::random(n)
๐ simulation::random(n) โ the manual, but make it cute ๐
okay bestie, so this is a page from the Tcl Simulation Tools manual, section n, and honestly? it's a banger. it's called simulation::random and it's literally all about pseudo-random number generators ๐ฒโจ. grab a snack, we're doing math but make it fashion.
โจ NAME โจ
simulation::random โ Pseudo-random number generators ๐ฒ
๐ธ SYNOPSIS ๐ธ
package require Tcl ?8.5 9?
package require simulation::random 0.4
::simulation::random::prng_Bernoulli p
::simulation::random::prng_Discrete n
::simulation::random::prng_Poisson lambda
::simulation::random::prng_Uniform min max
::simulation::random::prng_Triangular min max
::simulation::random::prng_SymmTriangular min max
::simulation::random::prng_Exponential min mean
::simulation::random::prng_Normal mean stdev
::simulation::random::prng_Pareto min steep
::simulation::random::prng_Gumbel min f
::simulation::random::prng_chiSquared df
::simulation::random::prng_Disk rad
::simulation::random::prng_Sphere rad
::simulation::random::prng_Ball rad
::simulation::random::prng_Rectangle length width
::simulation::random::prng_Block length width depth
like, that's the whole squad right there ๐
๐ฆ DESCRIPTION ๐ฆ
ok so this package is a lil collection of commands that build pseudo-random number generators for you. and the new commands it hands you? they deliver:
- numbers that are distributed normally, uniformly, according to a Pareto or Gumbel distribution and so on ๐
- coordinates of points uniformly spread inside a sphere or a rectangle ๐ง
for example, bestie:
set p [::simulation::random::prng_Normal -1.0 10.0]
this produces a new command (whose name gets stored in the variable p) that generates normally distributed numbers with a mean of -1.0 and a standard deviation of 10.0. so p isn't a number โ p is a whole generator. main character energy fr fr.
๐ PROCEDURES ๐
๐ the discrete distribution girlies
the package defines the following public procedures for discrete distributions:
::simulation::random::prng_Bernoulli pโ Create a command (PRNG) that generates numbers with a Bernoulli distribution: the value is either1or0, with a chancepto be 1 ๐float pโ Chance the outcome is 1
::simulation::random::prng_Discrete nโ Create a command (PRNG) that generates numbers0ton-1with equal probability โจint nโ Number of different values (ranging from0ton-1)
::simulation::random::prng_Poisson lambdaโ Create a command (PRNG) that generates numbers according to the Poisson distribution ๐ธfloat lambdaโ Mean number per time interval
๐ฉท the continuous distribution girlies
the package defines the following public procedures for continuous distributions:
::simulation::random::prng_Uniform min maxโ Create a command (PRNG) that generates uniformly distributed numbers betweenminandmax๐ฆfloat minโ Minimum number that will be generatedfloat maxโ Maximum number that will be generated
::simulation::random::prng_Triangular min maxโ Create a command (PRNG) that generates triangularly distributed numbers betweenminandmax. If the argumentminis lower than the argumentmax, then smaller values have higher probability and vice versa. In the first case the probability density function is of the formf(x) = 2(1-x)and the other case it is of the formf(x) = 2x๐float minโ Minimum number that will be generatedfloat maxโ Maximum number that will be generated
::simulation::random::prng_SymmTriangular min maxโ Create a command (PRNG) that generates numbers distributed according to a symmetric triangle around the mean ofminandmax๐บfloat minโ Minimum number that will be generatedfloat maxโ Maximum number that will be generated
::simulation::random::prng_Exponential min meanโ Create a command (PRNG) that generates exponentially distributed numbers with a given minimum value and a given mean value ๐float minโ Minimum number that will be generatedfloat meanโ Mean value for the numbers
::simulation::random::prng_Normal mean stdevโ Create a command (PRNG) that generates normally distributed numbers with a given mean value and a given standard deviation ๐float meanโ Mean value for the numbersfloat stdevโ Standard deviation
::simulation::random::prng_Pareto min steepโ Create a command (PRNG) that generates numbers distributed according to Pareto with a given minimum value and a given distribution steepness โฐ๏ธfloat minโ Minimum number that will be generatedfloat steepโ Steepness of the distribution
::simulation::random::prng_Gumbel min fโ Create a command (PRNG) that generates numbers distributed according to Gumbel with a given minimum value and a given scale factor. The probability density function is:
P(v) = exp( -exp(f*(v-min)))
float minโ Minimum number that will be generatedfloat fโ Scale factor for the values
::simulation::random::prng_chiSquared dfโ Create a command (PRNG) that generates numbers distributed according to the chi-squared distribution withdfdegrees of freedom. The mean is0and the standard deviation is1๐ฏfloat dfโ Degrees of freedom
๐ง random point set girlies
the package defines the following public procedures for random point sets:
::simulation::random::prng_Disk radโ Create a command (PRNG) that generates(x,y)-coordinates for points uniformly spread over a disk of given radius ๐ฟfloat radโ Radius of the disk
::simulation::random::prng_Sphere radโ Create a command (PRNG) that generates(x,y,z)-coordinates for points uniformly spread over the surface of a sphere of given radius ๐float radโ Radius of the disk
::simulation::random::prng_Ball radโ Create a command (PRNG) that generates(x,y,z)-coordinates for points uniformly spread within a ball of given radius ๐ฎfloat radโ Radius of the ball
::simulation::random::prng_Rectangle length widthโ Create a command (PRNG) that generates(x,y)-coordinates for points uniformly spread over a rectangle ๐ผ๏ธfloat lengthโ Length of the rectangle (x-direction)float widthโ Width of the rectangle (y-direction)
::simulation::random::prng_Block length width depthโ Create a command (PRNG) that generates(x,y,z)-coordinates for points uniformly spread over a block ๐ฆfloat lengthโ Length of the block (x-direction)float widthโ Width of the block (y-direction)float depthโ Depth of the block (z-direction)
๐ฅ KEYWORDS ๐ฅ
math, random numbers, simulation, statistical distribution
โญ CATEGORY โญ
Mathematics
๐ COPYRIGHT ๐
Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net>
no cap: every single one of those procedures makes a new command, not a number. store it in a variable or it's gonna be giving ghost ๐ป โ iykyk.
okay that's the whole page bestie, you ate it ๐
โจ this one's from the tcllib docs, version 0.4, and it's filed under simulation::random(n). mwah, go generate some numbers ๐ฒ๐
๐ฆ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 ยท TCL
- fedora 44: tcllib 2.0-4.fc44 ยท TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2004 Arjen Markus <arjenmarkus@users\&.sourceforge\&.net>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms