Is it possible to set a random number (random) in some range, for example, from 100 to 200. And not from scratch ...
random(201) // 0 - 200
Is it possible to set a random number (random) in some range, for example, from 100 to 200. And not from scratch ...
random(201) // 0 - 200
random(100)+100
random(101)+100
. - KromsterThe Math
module has a special function:
function RandomRange(const RangeFrom, RangeTo: Integer): Integer;
Delphi function
RandomRange
generates an arbitrary integer (integer) within the rangeRangeFrom
andRangeTo
.It provides a more convenient version of the
Random
function of theSystem
module.Both use a pseudo-random number sequence of 2 ^ 32 values. Each time you run your program, the generated values will be the same, unless you install the generator in an arbitrary part of the sequence, using the
Randomize
orRandSeed
.
Source: https://ru.stackoverflow.com/questions/71095/
All Articles