shufrans(3M)

NAME
shufrans - random number shufflers

SYNOPSIS

cc [ flag ... ] file ... -lsunmath -lm [ library ... ]

#include <sunmath.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(3C), rand(3C) and random(3B).