Hi again,
With silly question...
I read about generating random numbers
random(10); but it gives numbers from 0 to 10 and i need for example from 10 to 100.
I tried random([10..100]); but i can't compile this :/
Could somebody help me?
Hi again,
With silly question...
I read about generating random numbers
random(10); but it gives numbers from 0 to 10 and i need for example from 10 to 100.
I tried random([10..100]); but i can't compile this :/
Could somebody help me?
Jump to Postlow+random(maximum-low+1)
So
10 + random(100-10+1)
random(10) gives values until 9.
Jump to Postuses Math; .... var d: integer; begin d := RandomRange(10,100); end;
low+random(maximum-low+1)
So
10 + random(100-10+1)
random(10) gives values until 9.
uses
Math;
....
var
d: integer;
begin
d := RandomRange(10,100);
end;
thanks tonyjv, your code worked :)
But another problem ocurred, i haven't thought that random will give me numbers like 11,12,13 etc haha
Im using 20,40,60 etc numbers so yeah tryin to solve this, can someone still help me?
trunc(my_random_number/10)*10
I do not understand why you need random numbers. 12,13,14 - this sequence.
read my post i dont need these numbers i only need 20,40,60 etc numbers because my program runs on 20x20 rectangles :)
What is the difficulty. You have already prompted all that is required. Think beyond yourself. This is an elementary task.
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.