The Programming Concept:
In most of the programming languages, random function returns a real number; therefore the real number would then have to be rounded to produce a random integer. For illustration,
>> round(rand*10)
would produce one random integer in the range from 0 to 10 (rand*10 would generate a random real in the range from 0 to 10; from which rounding will return an integer). Or, to produce a random integer in a range:
>> low = 2;
>> high = 6;
>> round(rand*(high-low)+low)
This would produce a random integer in the range from 2 to 6.