Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

5. Language Reference > Random Function

Name

Random Function

Syntax

function Random: Extended;
function Random(Limit: Integer): Integer;

Description

The Random function returns a pseudorandom number. Without arguments, it returns a floating-point number in the range ≤ Result < 1. The second form takes an integer argument and returns an integer in the range ≤ Result < Limit. Random is not a real function.

Tips and Tricks

  • Delphi uses a pseudorandom number generator (PRNG) with a cycle of 232. Although adequate for simple simulations, it is not suitable for use in encryption or other areas where you need a high-quality PRNG.

  • Call Randomize once to start the sequence of pseudorandom numbers at a different number each time you run the program.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint