From Clomosy Docs

No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:
<b>Example</b><br>
<b>Example</b><br>
In the example, when the program is executed, a random number between 10 and 20 will be generated.<br>
In the example, when the program is executed, a random number between 10 and 20 will be generated.<br>
<b>TRObject Syntax</b><br>
 
<pre>
<pre>
var
var
Line 17: Line 17:
   ShowMessage('The generated number: '+IntToStr(NumberOfPredictions));
   ShowMessage('The generated number: '+IntToStr(NumberOfPredictions));
}
}
</pre>
<b>Base Syntax</b><br>
<pre>
var
  NumberOfPredictions : Integer;
begin
  NumberOfPredictions := clMath.GenerateRandom(10,20);
  ShowMessage('The generated number: '+IntToStr(NumberOfPredictions));
end;
</pre>
</pre>


Line 36: Line 26:
<h2> See Also </h2>
<h2> See Also </h2>
* [[ClMath | ClMath]]
* [[ClMath | ClMath]]
{{#seo:|title=GenerateRandom in Clomosy - Clomosy Docs}}
{{#seo:|description=Learn to generate random numbers using the clMath.GenerateRandom function in Clomosy.}}

Latest revision as of 15:15, 24 December 2024

This function is a custom function used on the Clomosy platform. It is employed to generate a random number between two numerical values. The randomly generated number within the function is inclusive of the first parameter but exclusive of the last parameter.


Example
In the example, when the program is executed, a random number between 10 and 20 will be generated.

var
  NumberOfPredictions : Integer;

{
  NumberOfPredictions = clMath.GenerateRandom(10,20);
  ShowMessage('The generated number: '+IntToStr(NumberOfPredictions));
}

Output:

See Also