線性同餘-常見語言編譯器引數

Yofoo發表於2024-05-10
Source m (multiplier) a (increment) c output bits of seed in rand() /Random(L)
Numerical Recipes 232 1664525 1013904223
Borland C/C++ 232 22695477 1 bits 30..16 in rand(), 30..0 inlrand()
glibc (used by GCC)[5] 231 1103515245 12345 bits 30..0
ANSI C: Watcom, Digital Mars, CodeWarrior, IBM VisualAgeC/C++ [6] 231 1103515245 12345 bits 30..16
C99, C11: Suggestion in the ISO/IEC 9899 [7] 232 1103515245 12345 bits 30..16
Borland Delphi, Virtual Pascal 232 134775813 1 bits 63..32 of (seed * L)
Microsoft Visual/Quick C/C++ 232 214013 (343FD16) 2531011 (269EC316) bits 30..16
Microsoft Visual Basic (6 and earlier)[8] 224 1140671485 (43FD43FD16) 12820163 (C39EC316)
RtlUniform from Native API[9] 231 ? 1 2147483629 (7FFFFFED16) 2147483587 (7FFFFFC316)
Apple CarbonLib, C++11's minstd_rand0[10] 231 ? 1 16807 0 see MINSTD
C++11's minstd_rand[10] 231 ? 1 48271 0 see MINSTD
MMIX by Donald Knuth 264 6364136223846793005 1442695040888963407
Newlib, Musl 264 6364136223846793005 1 bits 63...32
VMS's MTH$RANDOM,[11] old versions of glibc 232 69069 1
Java's java.util.Random, POSIX [ln]rand48, glibc[ln]rand48[_r] 248 25214903917 (5DEECE66D16) 11 bits 47...16
POSIX[12] [jm]rand48, glibc [mj]rand48[_r] 248 25214903917 (5DEECE66D16) 11 bits 47...15
POSIX [de]rand48, glibc [de]rand48[_r] 248 25214903917 (5DEECE66D16) 11 bits 47...0
Formerly common: RANDU [4] 231 65539 0

相關文章