Generate a random number generator for Cauchy deviates
This functionality does not run in MATLAB.
stats::cauchyRandom(a
, b
, <Seed = n
>)
stats::cauchyRandom(a, b)
returns a procedure
that produces Cauchy deviates
(random numbers) with median a and
scale parameter b > 0.
The procedure f := stats::cauchyRandom(a, b)
can
be called in the form f()
. The return value of f()
is
either a floatingpoint number or a symbolic expression:
If a
can be converted to a real floating
point number and b
to a positive real floating
point number, then f()
returns a real floating
point number.
In all other cases, f() returns
the symbolic call stats::cauchyRandom(a, b)()
.
Numerical values of a
and b
are
only accepted, if they are real and b is
positive.
The values X = f()
are distributed randomly
according to the the Cauchy distribution with parameters a
and b
.
For any real x
, the probability that X ≤ x is
given by
.
Without the option Seed = n
, an initial seed
is chosen internally. This initial seed is set to a default value
when MuPAD^{®} is started. Thus, each time MuPAD is started
or reinitialized with the reset
function,
random generators produce the same sequences of numbers.
Note:
In contrast to the function 
For efficiency, it is recommended to produce sequences of K random numbers via
f := stats::cauchyRandom(a, b): f() $ k = 1..K;
stats::cauchyRandom(a, b)() $k = 1..K;
stats::cauchyRandom(a, b, Seed = n)() $ k = 1..K;
The function is sensitive to the environment variable DIGITS
which
determines the numerical working precision.
We generate Cauchy deviates with parameters a = 2 and :
f := stats::cauchyRandom(2, 3/4): f() $ k = 1..4
delete f:
With symbolic parameters, no random floatingpoint numbers can be produced:
f := stats::cauchyRandom(a, b): f()
When a and b evaluate to suitable real numbers, the generator starts to produce random numbers:
a := PI: b := 1/2: f() $ k = 1..4
delete f, a, b:
We use the option Seed
= n
to
reproduce a sequence of random numbers:
f := stats::cauchyRandom(PI, 3, Seed = 1): f() $ k = 1..4
g := stats::cauchyRandom(PI, 3, Seed = 1): g() $ k = 1..4
f() = g(), f() = g()
delete f, g:

The median: an arithmetical expression representing a real value 

The scale parameter: an arithmetical expression representing a positive real value 

Option, specified as Initializes the random generator with the integer seed This option serves for generating generators that return predictable
sequences of pseudorandom numbers. The generator is initialized with
the seed When this option is used, the parameters 
The implemented algorithm for the computation of the Cauchy deviates uses the quantile function of the Cauchy distribution applied to uniformly distributed random numbers between 0 and 1.