/* Three-generator random number algorithm *ofBrianWichmannandDavidHill *BYTEmagazine,March,1987pp127-8 * *Theperiod,givenbythem,is(p-1)(q-1)(r-1)/4=6.95e12.
*/
int drand( a ) double *a;
{ unsignedshort r; #ifdef DEC unsignedshort s, t; #endif
/* This algorithm of Wichmann and Hill computes a floating point *result:
*/
ranwh();
unkans.d = sx/30269.0 + sy/30307.0 + sz/30323.0;
r = unkans.d;
unkans.d -= r;
unkans.d += 1.0;
/* if UNK option, do nothing further. *Otherwise,makearandom16bitinteger *tooverwritetheleastsignificantword *ofunkans.
*/ #ifdef UNK /* do nothing */ #else
ranwh();
r = sx * sy + sz; #endif
#ifdef DEC /* To make the numbers as similar as possible *inallarithmetics,therandomintegerhas *tobeinserted3bitshigherupinaDECnumber. *Analternativewouldbeputit3bitslowerdown *inalltheothernumbertypes.
*/
s = unkans.s[2];
t = s & 07; /* save these bits to put in at the bottom */
s &= 0177770;
s |= (r >> 13) & 07;
unkans.s[2] = s;
t |= r << 3;
unkans.s[3] = t; #endif
#ifdef IBMPC
unkans.s[0] = r; #endif
#ifdef MIEEE
unkans.s[3] = r; #endif
*a = unkans.d; return0;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-14)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.