This repository has been archived by the owner on May 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
X4.1 Random value
Oldřich Koželský edited this page Jan 6, 2021
·
1 revision
Random value generation is governed by a common algorithm, internally implemented as an extension of the standard Random class. In RCNet, random values are used very often and it is usually necessary to specify parameters for the random value generation.
The common algorithm has parameters that match the "RandomValueType" type in RCNetTypes.xds defined as follows:
<!-- Random value -->
<xs:complexType name="RandomValueType">
<xs:choice minOccurs="0" maxOccurs="1">
<xs:element type="UniformDistrType" name="uniformDistr" minOccurs="1" maxOccurs="1"/>
<xs:element type="GaussianDistrType" name="gaussianDistr" minOccurs="1" maxOccurs="1"/>
<xs:element type="ExponentialDistrType" name="exponentialDistr" minOccurs="1" maxOccurs="1"/>
<xs:element type="GammaDistrType" name="gammaDistr" minOccurs="1" maxOccurs="1"/>
</xs:choice>
<xs:attribute type="xs:double" name="min" use="required"/>
<xs:attribute type="xs:double" name="max" use="required"/>
<xs:attribute type="xs:boolean" name="randomSign" use="optional" default="false">
<xs:annotation>
<xs:documentation xml:lang="en">Default value is false</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
Example:
<exampleRandomValue min="-1" max="1" randomSign="false">
<uniformDistr/>
</exampleRandomValue>
Attribute | Description |
---|---|
min,max | The base range of the random value is defined by the "min" and "max" borders. Parameters are real numbers, so they can be negative. The condition that "min" is less than or equal to "max" must be met |
randomSign | Parameter may be true or false and determines whether the sign of the selected value will be additionally randomly changed |
In RCNet are implemented following random distributions:
- Generate random value within the range "min" and "max", using specified "distribution"
- If the "randomSign" is set to true
- randomly generate a sign (-1 or 1)
- multiply random value by the generated sign
- If you want to generate random values from continuous range, specify appropriate "min" and "max" and set "randomSign" to "false". For example specify "min"=-2.5, "max"=3.1 to generate random values within the range <-2.5, 3.1>
- If you want to generate random values within the positive and negative range, specify positive "min" and "max" and set "randomSign" to "true". For example specify "min"=1, "max"=2 to generate random values within the ranges <-2, -1> and <1, 2>
Questions, ideas, suggestions for improvement and constructive comments are welcome at my email address [email protected] or newly you can use github discussions.