Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

random function in Crystal Reports 1

Status
Not open for further replies.

CrystalizeCanada

Instructor
Mar 4, 2009
141
CA
Hi there,

Is there an random function in Crysal Reports XI that would help generated a series of random numbers between 0 to 100? I need a different random number for each record.

If it could be uniform random that would be great.

Thanks



Gordon BOCP
Crystalize
 
Hi,
Here is an excerpt from the CR online help about the RND() function...Manipulating it should get you what you want:

crw.chm said:
Rnd
Basic and Crystal syntax.

Overloads
Rnd ()
Rnd (seed)
Arguments
seed is an optional Number value argument.
Returns
A Number value.

Action
Rnd returns a random number greater than or equal to 0 and less than 1. If seed is equal to 0, Rnd returns the random number that was returned from the previous call to Rnd. If seed is not supplied or is greater than 0, then Rnd returns the next random number in the internally generated sequence of random numbers. If seed is less than 0, then Rnd uses this value of seed to start a new random number sequence and returns the first value in this sequence.

Typical uses
Used when your formula requires a randomly generated number such as for statistical calculations or for selecting records at random to limit the data in a report.

Comments
This function is similar to the Visual Basic function of the same name.
You can call Rnd without ever starting a new random number sequence by specifying a negative seed argument. If you do so, an internal seed will be generated using the system clock.
The reason to start a new random number sequence by calling Rnd with a negative seed argument, and then making subsequent calls to Rnd without an argument (or with a positive argument) is so that the report will look exactly the same every time it is previewed. In other words, it allows you to make use of random numbers, but get a reproducible result.

--------------------------------------------------------------------------------


Crystal Decisions
Support services

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks Turkbear,

I did a search for Rand. Didn't think to search for rnd. Won't forget next time

Gordon

Gordon BOCP
Crystalize
 
Hi,
no problem..Every program seems to have a different term/word/spelling/etc for things..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top