why my randomize commond doesn`t work in my pascal program? i used many loops in my program which i put the randomize after the first begin of the program.

Is there some one can tell me how to place the randomize command in a complicated pascal program!

:rolleyes:

THX...........

Easy, put this right after the first begin and then use x:=random(y)+1 to get a random integer.

program blah;
var a,b:integer;
begin 
for a:= 1 to 1000000 do inc(b);
a:=random(10)+1; {this makes "a" a random number from 1 to 10}
writeln(a);
end.

Hi,

Randomize just seeds the Random Number Generator (RNG) of Pascal/Delphi with the current time. You better put it as the first line of the code or before the first call to random() function. It doesn't have to be called many times just once is enough. If you don't use it your random() function would generate the same sequence every time you run your program.

Loren Soth

Hi, can someone please tell me what writeln means? I have done a random command and I haven't used that, and what are you making angus1910?

Hi, can someone please tell me what writeln means? I have done a random command and I haven't used that, and what are you making angus1910?

Writeln -> Write Line (to the console which is screen)