Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ shufrans(3M) — SPARCworks 2.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

addrans(3M)

drand48(3)

lcrans(3M)

rand(3C)

rand(3V)

random(3)

SHUFRANS(3M)  —  MATHEMATICAL LIBRARY

NAME

shufrans − random number shufflers

SYNOPSIS

#include <math.h>

void i_shufrans_(int ∗x, int ∗n, int ∗l, int ∗u);

void u_shufrans_(unsigned ∗x, int ∗n, unsigned ∗l, unsigned ∗u);

void r_shufrans_(float ∗x, int ∗n, float ∗l, float ∗u);

void d_shufrans_(double ∗x, int ∗n, double ∗l, double ∗u);

DESCRIPTION

These functions shuffle random numbers, uniform on [∗l,∗u], generated by any method.  The shuffling method is that called "Algorithm B" by Knuth.  An internal table of between 4 and 256 elements is allocated for the shuffling depending on ∗n.

EXAMPLES

to shuffle 1000 double-precision random variates in [lb,ub]

double x[1000] ; int n = 1000 ; double lb, ub;
 d_shufrans_(x, &n, &lb, &ub) ;

SEE ALSO

addrans(3M), drand48(3), lcrans(3M), rand(3C), rand(3V), random(3). 

Knuth, Seminumerical Algorithms, 1981, Addison-Wesley. 

Park and Miller, Random Number Generators: Good Ones are Hard to Find, Communications of the ACM, October 1988. 

NOTES

For efficiency, the lcrans(3M) functions, probably with shufrans(3M), are recommended for normal use over those in addrans(3M), drand48(3), rand(3C), rand(3V) and random(3). 

Sun Release 4.1  —  Last change: 9 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026