Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

The Wiert Corner - irregular stream of stuff: jpluimers

$
0
0

Calling Randomize too often can make your Random numbers even less random.

Sometimes having the Randomize call in a unit initialization section is not practical.

Hence this little method that I think I first wrote back in the Turbo Pascal days:

procedure RandomizeIfNeeded();
begin
  if RandSeed = 0 then 
    Randomize();
end;

–jeroen


Filed under: Delphi, Delphi 1, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi for PHP, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, Pascal, Software Development, Turbo Pascal

Viewing all articles
Browse latest Browse all 1725

Trending Articles