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?

Re: Random number (not ordinary) 80 80

low+random(maximum-low+1)

So

10 + random(100-10+1)

random(10) gives values until 9.

Re: Random number (not ordinary) 80 80
uses
  Math;
....
var
  d: integer;
begin
  d :=  RandomRange(10,100);
end;
Re: Random number (not ordinary) 80 80

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?

Re: Random number (not ordinary) 80 80

trunc(my_random_number/10)*10

Re: Random number (not ordinary) 80 80

I do not understand why you need random numbers. 12,13,14 - this sequence.

Re: Random number (not ordinary) 80 80

read my post i dont need these numbers i only need 20,40,60 etc numbers because my program runs on 20x20 rectangles :)

Re: Random number (not ordinary) 80 80

What is the difficulty. You have already prompted all that is required. Think beyond yourself. This is an elementary task.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.