simulation::random(n)

๐Ÿ“ฆ
version 2.0 ยท 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

๐Ÿ’– 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 either 1 or 0, with a chance p to be 1 ๐ŸŽ€
    • float p โ€” Chance the outcome is 1
  • ::simulation::random::prng_Discrete n โ€” Create a command (PRNG) that generates numbers 0 to n-1 with equal probability โœจ
    • int n โ€” Number of different values (ranging from 0 to n-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 between min and max ๐Ÿฆ‹
    • float min โ€” Minimum number that will be generated
    • float max โ€” Maximum number that will be generated
  • ::simulation::random::prng_Triangular min max โ€” Create a command (PRNG) that generates triangularly distributed numbers between min and max. If the argument min is lower than the argument max, then smaller values have higher probability and vice versa. In the first case the probability density function is of the form f(x) = 2(1-x) and the other case it is of the form f(x) = 2x ๐Ÿ“
    • float min โ€” Minimum number that will be generated
    • float 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 of min and max ๐Ÿ”บ
    • float min โ€” Minimum number that will be generated
    • float 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 generated
    • float 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 numbers
    • float 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 generated
    • float 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 generated
  • float 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 with df degrees of freedom. The mean is 0 and the standard deviation is 1 ๐ŸŽฏ
    • 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 (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