Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step tutorials and online videos.

Click Here To Learn More »

9.07 Random Numbers

Generating Random Numbers

Generating random numbers using the Rnd() function. When you use random numbers, you normally want to tell the computer to generate a new random number sequence based upon some internal method (usually using the system clock). This still applies with Basic syntax. The Rnd() function has an optional parameter that lets tell the computer to generate a new random number sequence. With Basic syntax you can pass your own random number seed value to generate the sequence. This is beneficial if you are writing a report that uses random numbers and want to test it using the same random number sequence each time. If you pass the Rnd() function a positive number, then it does just that. However, if you want your sequence to be different every time, and thus your report will have different numbers every time, pass the Rnd() function a negative number. This tells it to use the system clock to generate the random number sequence. This results in a pseudo-random sequence of numbers each time you call it. Once you have called Rnd() with a seed, call the Rnd() function without a seed to get the next random number in the sequence.

Get UNLIMITED Crystal Reports Online Training!

Click Here To Start Your Training!

1500+ Tutorial Pages

Complete Crystal Reports Online Training with over 1,500 pages of better than book quality Crystal Reports tutorials.

Step-by-step Online Videos

Learn at your own pace from the comfort of your home! Pause, rewind and watch online training videos anytime!

Online Community

Members-only community where you can post and answer questions. The community is checked on a regular basis by best selling Crystal Reports book author Brian Bischof to help answer your questions.

Cut & Paste Source Code

Save time with simple cut and paste source code you can use right now in your next report!

Click Here To Start Your Training!