Tested on amd64, i386 (qemu), big-endian powerpc64 (qemu). I spot-checked that the new implementation produces the same values as the old one.
Below are timing differences for a program which generates 100000000 numbers from a random seed. The new implementation is faster in all cases, especially for drand48() and erand48(), which are implemented by converting the LCG output to a floating point number in the range [0, 1).
```
Using seed: 160565650
x /tmp/drand48.unmodified
+ /tmp/drand48.modified
+-----------------------------------------------------------------------------+
| + x x|
| + x x|
|+ + x x|
|+ ++ x x|
|+ ++ x x|
| |_AM| |_A||
+-----------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 10 1.06 1.08 1.07 1.07 0.010540926
+ 10 0.54 0.57 0.565 0.559 0.013703203
Difference at 95.0% confidence
-0.511 +/- 0.0114863
-47.757% +/- 0.917009%
(Student's t, pooled s = 0.0122247)
x /tmp/erand48.unmodified
+ /tmp/erand48.modified
+-----------------------------------------------------------------------------+
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|A A|
+-----------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 10 1.1 1.1 1.1 1.1 2.3405556e-16
+ 10 0.75 0.75 0.75 0.75 0
Difference at 95.0% confidence
-0.35 +/- 1.55505e-16
-31.8182% +/- 9.63875e-15%
(Student's t, pooled s = 1.65502e-16)
x /tmp/lrand48.unmodified
+ /tmp/lrand48.modified
+-----------------------------------------------------------------------------+
|+ |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x x|
|A |_A_| |
+-----------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 10 0.35 0.36 0.35 0.351 0.0031622777
+ 10 0.24 0.24 0.24 0.24 5.8513891e-17
Difference at 95.0% confidence
-0.111 +/- 0.002101
-31.6239% +/- 0.409282%
(Student's t, pooled s = 0.00223607)
x /tmp/nrand48.unmodified
+ /tmp/nrand48.modified
+-----------------------------------------------------------------------------+
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|+ x|
|A A|
+-----------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 10 0.6 0.6 0.6 0.6 1.1702778e-16
+ 10 0.55 0.55 0.55 0.55 1.1702778e-16
Difference at 95.0% confidence
-0.05 +/- 1.09959e-16
-8.33333% +/- 1.75795e-14%
(Student's t, pooled s = 1.17028e-16)
x /tmp/mrand48.unmodified
+ /tmp/mrand48.modified
+-----------------------------------------------------------------------------+
|+ + x |
|+ + x |
|+ + x |
|+ + x |
|+ + x x|
||__A_| MA| |
+-----------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 10 0.51 0.52 0.51 0.511 0.0031622777
+ 10 0.22 0.24 0.23 0.23 0.010540926
Difference at 95.0% confidence
-0.281 +/- 0.00731169
-54.9902% +/- 1.38295%
(Student's t, pooled s = 0.00778175)
x /tmp/jrand48.unmodified
+ /tmp/jrand48.modified
+-----------------------------------------------------------------------------+
|+ |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x |
|+ x x |
|A |A||
+-----------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 10 0.75 0.76 0.76 0.759 0.0031622777
+ 10 0.53 0.53 0.53 0.53 1.1702778e-16
Difference at 95.0% confidence
-0.229 +/- 0.002101
-30.1713% +/- 0.193294%
(Student's t, pooled s = 0.00223607)
```