English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need to put into array numbers from 0 to 10
i tried to do this :
for i:=1 to 10 do
begin
randomize;
T[i]:=random(10);
end;
but the problem that it is that the same integer in all the elments
for example if the first element become 4 all the other become 4 I also tried to insialized but it still don't work.

2006-08-10 23:12:44 · 1 answers · asked by Anonymous in Computers & Internet Programming & Design

1 answers

Ahmad

Randomize initialises the longint RandSeed with a 32-bit value derived by permuting values (H, M, S, C) from the DOS time. Previously thought to be from permuting the date and the time; could this have been another version of Pascal? The time has 55 ms resolution; be sure to consider whether this is adequate. There are only $1800B0 ticks per day (and fewer per working day), so the initial RandSeed cannot take all possible values of its type, by a factor of $100000000/$1800B0 ~ $AAA = 2730.

In Delphi, RandSeed is initialised differently (dependent on version). D3 (& D4, D6 apparently) uses milliseconds since midnight GMT, which would imply that the initial RandSeed cannot take all possible values of its type by a factor of $100000000/86400000 = $31 = 49. However, at least in my D3, the number of milliseconds is always divisible by 10, and evidently rises at 18.2 Hz; it must be derived from the DOS timer at $40:$6C, as for Pascal 7 above. The factor is again ~2730.

2006-08-10 23:21:50 · answer #1 · answered by Joe_Young 6 · 0 1

fedest.com, questions and answers