1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

Random

unit
System
category
random number

declaration
function Random[(MaxValue: Integer)];

description
Returns a randomly generated number within a specified range.

If MaxValue is not specified Random returns a real number X where 0 <= x <1. If MaxValue is specified the X than falls between 0 and MaxValue. To initialize the random number generator, call (once) the Randomize procedure.

example
 Randomize;

 Random; // results in a random number 0 <= x <1  
 Random(50); // results in a random number 0 <= x <50  
 

in real code

see also
Randomize, RandomRange, RandomFrom,


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.