50g: an interesting RAND anomaly
03-20-2018, 06:03 AM
Post: #20
 cyrille de brĂ©bisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: 50g: an interesting RAND anomaly
Hello,

Here is the random generator source code. This should give you ALL the info you may want (including the reason why you see what you are seeing).
HP_Real fRand(uint64_t *Seed)
{
if (*Seed==0LL) *Seed= BaseSeed;
HP_Real r; r.M= 0LL;
uint64_t c= 0x2851130928467LL;
for (int i= 13; --i>=0; i--)
{
r.M= dcb_muladd(r.M, *Seed, ((uint32_t)c)&15); // r.M= r.M+seed*low nibble of c
*Seed<<= 4;
c>>= 4;
}
*Seed= r.M&0x0fffffffffffffffLL; // update seed for next time
r.e= -1; r.s= SignPos; // result's exponent is -1 and sign is pos
while((r.M&0xf00000000000000LL)==0) { r.M <<= 4; r.e--; } // Normalize real
r.M &= 0x0ffffffffffff000LL; // round to 12 significant digits
return r;
}

Cheers,
Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
 « Next Oldest | Next Newest »

 Messages In This Thread 50g: an interesting RAND anomaly - DavidM - 03-17-2018, 05:02 PM RE: 50g: an interesting RAND anomaly - J-F Garnier - 03-17-2018, 05:43 PM RE: 50g: an interesting RAND anomaly - DavidM - 03-17-2018, 06:13 PM RE: 50g: an interesting RAND anomaly - Claudio L. - 03-17-2018, 06:41 PM RE: 50g: an interesting RAND anomaly - DavidM - 03-17-2018, 07:38 PM RE: 50g: an interesting RAND anomaly - John Keith - 03-17-2018, 09:17 PM RE: 50g: an interesting RAND anomaly - DavidM - 03-17-2018, 10:23 PM RE: 50g: an interesting RAND anomaly - pier4r - 03-17-2018, 10:43 PM RE: 50g: an interesting RAND anomaly - ttw - 03-18-2018, 02:03 AM RE: 50g: an interesting RAND anomaly - Thomas Okken - 03-18-2018, 03:44 AM RE: 50g: an interesting RAND anomaly - DavidM - 03-18-2018, 04:08 PM RE: 50g: an interesting RAND anomaly - Paul Dale - 03-18-2018, 10:52 PM RE: 50g: an interesting RAND anomaly - John Keith - 03-19-2018, 02:23 PM RE: 50g: an interesting RAND anomaly - DavidM - 03-19-2018, 02:57 PM RE: 50g: an interesting RAND anomaly - pier4r - 03-19-2018, 03:04 PM RE: 50g: an interesting RAND anomaly - DavidM - 03-19-2018, 03:26 PM RE: 50g: an interesting RAND anomaly - ttw - 03-19-2018, 06:31 PM RE: 50g: an interesting RAND anomaly - pier4r - 03-19-2018, 07:08 PM RE: 50g: an interesting RAND anomaly - ttw - 03-19-2018, 07:35 PM RE: 50g: an interesting RAND anomaly - cyrille de brĂ©bisson - 03-20-2018 06:03 AM RE: 50g: an interesting RAND anomaly - Joe Horn - 03-20-2018, 05:47 PM RE: 50g: an interesting RAND anomaly - DavidM - 03-21-2018, 02:10 AM

User(s) browsing this thread: 1 Guest(s)