Ask the Expert

API to select a number at random

We need to select employees at random to do drug testing. Is there a way to select a number at random via an RPG function or something?

There is an API that can do this:

Basic Random Number Generation (CEERAN0) API
This API will generate a number between 0 and 1. (You can multiply the fraction to get the number of random digits you desire.) It is called with 2 parameters and returns a fraction between 0 and 1.

Details can be found here:
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/apis/CEERAN0.htm

This was first published in April 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: