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 

    2 answers 2

     random(100)+100 
    • Just to clarify, there will be numbers from 100 to 199. From 100 to 200 you need the code random(101)+100 . - Kromster

    The Math module has a special function:

     function RandomRange(const RangeFrom, RangeTo: Integer): Integer; 

    Delphi function RandomRange generates an arbitrary integer (integer) within the range RangeFrom and RangeTo .

    It provides a more convenient version of the Random function of the System 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 or RandSeed .

    http://delphibasics.ru/RandomRange.php