RandomTools Flavor: float
describe a flavor of a random floating-point number
equation(s) of the form option = value where option is one of range, digits, or method; specify options for the random floating-point number
The flavor float describes a random floating-point number in a particular range.
To describe a flavor of a random floating-point number, use either float or float(opts) (where opts is described following) as the argument to RandomTools[Generate] or as part of a structured flavor.
By default, the flavor float describes a random floating-point number logarithmically distributed in the range epsilon..1.0 - epsilon, inclusive, where epsilon = 10e-Digits.
You can modify the properties of the random floating-point number by using the float(opts) form of this flavor. The opts argument can contain one or more of the following equations.
range = a..b
This option specifies the range from which the random float is chosen. The range endpoints a and b are numeric and when using method=logarithmic, either a >= 0.0 or b <= 0.0. All numerics are evaluated by using the setting of the digits option.
If a=0., then a is set to the smallest value of the form 1eN such that b+1eN>b. If b=0., then b is set to the smallest value of the form −1eN such that a−1eN<a.
If b<a, an exception is raised.
digits = posint
This option specifies a positive integer to use as the Digits setting. The default setting is the current setting of the Digits environment variable.
method = uniform or logarithmic
This option specifies whether the floating-point number should be chosen logarithmically or uniformly from the interval.
The logarithmic method is identical to listing all of the unique floating-point numbers that are found between the endpoints, and then choosing one of these randomly.
The uniform method is similar to sampling from a uniform distribution that is bounded by the endpoints, and then converting this result into a floating-point number.
The default value for this option is uniform.
Download Help Document
What kind of issue would you like to report? (Optional)