by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 5.0, Creation date: 2021-01-15, Last change: 2025-09-15
See Also: , randdice
, meanGauss
y=randnorm([r,c,m,s])
r: | rows | |
c: | cols; default is r | |
m: | mean | |
s: | standard deviation |
y: | random numbers |
randnorm(6,1)
randnorm(6,1,100,5)
randnorm(6,1,100,5); meanGauss(ans)
This function, randnorm, generates random numbers with a normal distribution. It is part of the SolidGeometry library and was introduced in version 5.0. The function is designed to be an auxiliary procedure for generating normally distributed random numbers.
r.[r, c], drawn from a normal distribution with mean m and standard deviation s.The function begins by retrieving the input parameters using the helper function getfuncparams. This function is called four times to obtain the values for r, c, m, and s. The default values are set as follows:
r defaults to 1 if not provided.c defaults to 1 if not provided.m defaults to 0 if not provided.s defaults to 1 if not provided.After obtaining the parameters, the function uses the normrnd function to generate a matrix of random numbers. The normrnd function takes the mean m, standard deviation s, and the size of the output matrix [r, c] as inputs. The result is stored in the variable y, which is then returned as the output of the function.
randnorm(6,1): Generates a 6x1 matrix of random numbers with a mean of 0 and a standard deviation of 1.randnorm(6,1,100,5): Generates a 6x1 matrix of random numbers with a mean of 100 and a standard deviation of 5.randnorm(6,1,100,5); meanGauss(ans): Generates a 6x1 matrix of random numbers with a mean of 100 and a standard deviation of 5, then calculates the mean of the generated numbers using the meanGauss function.