'\" t .\" @(#)shufrans.3m 1.14 98/02/04 SMI; .TH shufrans 3M "1 Sep 1993" .SH NAME shufrans \- random number shufflers .SH SYNOPSIS .LP .B cc .RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." .B \-lsunmath -lm .RI "[ " "library" " \|.\|.\|. ]" .LP .B #include .LP .BI "void i_shufrans_(int *" "x" , .BI "int *" "n" , .BI "int *" "l" , .BI "int *" "u" ); .LP .BI "void u_shufrans_(unsigned *" "x" , .BI "int *" "n" , .BI "unsigned *" "l" , .BI "unsigned *" "u" ); .LP .BI "void r_shufrans_(float *" "x" , .BI "int *" "n" , .BI "float *" "l" , .BI "float *" "u" ); .LP .BI "void d_shufrans_(double *" "x" , .BI "int *" "n" , .BI "double *" "l" , .BI "double *" "u" ); .SH DESCRIPTION .\".IX "_1st_index_term_" "_2nd_index_term_" "_format_of_1st_" "_format_of_2nd_" .LP These functions shuffle random numbers, uniform on .RI [ *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 .IR *n . .SH EXAMPLES .SS to\0shuffle\01000\0double-precision\0random\0variates in [lb,ub] .LP .RS .ft B .nf double x[1000] ; int n = 1000 ; double lb, ub; d_shufrans_(x, &n, &lb, &ub) ; .fi .ft .RE .SH "SEE ALSO" .BR addrans (3M), .BR drand48 (3), .BR lcrans (3M), .BR mwcrans (3M), .BR rand (3C), .BR rand (3V), .BR random (3). .LP Knuth, .I "Seminumerical Algorithms," 1981, Addison-Wesley. .LP Park and Miller, .I "Random Number Generators: Good Ones are Hard to Find," Communications of the ACM, October 1988. .SH NOTES .LP For efficiency, the .BR lcrans (3M) functions, probably with .BR shufrans (3M), are recommended for normal use over those in .BR addrans (3M), .BR drand48 (3C), .BR rand (3C) and .BR random (3B).