Improved Random Number Generator 1

By BrandsPatch

Freeware 13 Feb 2008

In category

Code Samples > Samples > Other

Description

Random number sequences generated in Delphi using the native Random function leave much to be desired. By default the same number sequence is produced each time the parent application is run. Matters can be improved to a certain extent by seeding the random number generator using the system clock by calling the Randomize function.

However, this does not change the fact that the algorithm used is quite simplistic. Algorithms of greater complexity that claim to yield more random sequences abound. However, it is not really necessary to code such an algorithm. Windows comes with an intrinsic random number generator in the form of the CoCreateGUID function. We demonstrate how it can be used with a minimum of coding to create a truly robust sequence of pseudo-random numbers.

Informations

  • Status: Fully functional
  • Source: FW
  • Size: 243 586kB

Platforms:

  • Delphi 2005 (VCL)
  • Delphi 2006 (Win32)
  • Delphi 2007 (VCL)
  • Delphi 4
  • Delphi 5
  • Delphi 6
  • Delphi 7

Downloads