Random Float

The $RFloat function generates random float value. The function has the following parameters:

  1. (optional) Low border. Float, default is 0.
  2. (optional) High border. Float, default is 1 000 000.
  3. (optional) Decimal digits. Integer, default is 2. The maximum is 10. A negative value means generate rounded values with defined number of 0.
  4. (optional) Format. String, default is '{0}' for .net edition of the library and '%f' for Win32, Java and Web editions.
  5. (optional) Distribution*. String, default or the empty string means "even distribution".
  6. (optional) Dispersion value (for "Normal" distribution only). The default value is 1.

* - "Even", "Normal" or "Linear" distributions are only acceptable.

Note: function call, local or global variable are acceptable as the first and second parameter.

Examples

  1. $RFloat()
  2. $RFloat(-100,100)
  3. $RFloat(0,2000,3)
  4. $RFloat(100,2000,-2) - generates values like 400,1200,800,1900
  5. $RFloat(0,20,,%7.3f,Normal,5)
  6. $RFloat(@GV,#LV) - value between global variable GV and local variable LV