I was using This.Seed/2^64 when I should have used just This.Seed. Dear, oh dear. Your method is producing the same results as dafhi's and my Int method before that.
The reason why I used This.Seed, as opposed to This.Rand, is because the engine only takes up a few lines so I use the engine for every function to avoid calling another function. As it turns out the difference between the engine plus This.Seed and This.Rand is negligible. FB keeps surprising me.
Anyway, my original Int method, using '-gen gcc -Wc -O3' in 32-bit mode, was beaten by dafhi's method from 34MHz to 63MHz. Your method storms in at 135MHz.
The most extraordinary thing is using '-gen gcc -Wc -O3' in 64-bit mode saw my Int method and dafhi's method coming in at the same speed and now your method is the same. Goodness knows what the binary looks like and I find it hard to believe that all three methods have been reduced to the same native code. However, they are coming in at the same speed nonetheless.
Since you MODification has improved the 32-bit results I have revised the LongInt in the opening post yet again for folks who use 32-bit.
I must now sit down and fathom out how the Mod actually works. How did you come up with that? Is it from your archives or did you come up with it during the life of this thread? This is important because if you got it from your archives then you qualify for a fortnight in Clacton-On-sea. On the other hand, if you came up with it during the life of this thread you qualify for a week in Clacton-On-Sea. The burning question is are you going to tell 'porkies' to avoid going to Clacton for a fortnight.
I wonder what MrSwiss thinks about your Mod approach. We cannot get much more elegant than that and it is very close to being four times faster than my original Int method. That should definitely go into the manual but it will, I am sure, leave a lot of folks scratching their heads.
Actually, I am being unfair about Clacton because I have stayed in a few Bed & Breakfasts there and I have no complaints on that score. It is probably very good for families as there is plenty of stuff going on to keep the kids fully occupied. It is over 25 years since I was last there but there was a superb fish restaurant that I used to frequent owned by a divorced lady who I took a shine too. She knocked out a haddock to die for. <smile>