Random number generator

Hi,

I've seen that TSRandom has a method Range() that takes two floats. How can you ensure that the results will be the same on all machines?

Thanks,

Devis

Comments

  • TSRandom is always seeded, so values are guaranteed to be the same in all clients...:)
  • @erickpassos ok, that's perfectly fine. My question is about float parameters passed to it. How do you ensure that those values have the same representation on all clients?
  • Floats have the same representation always (IEEE 754), so for initialisation stuff, using floats work fine. The issue happens on certain operations (multiplication and division, trig functions, for example), where CPU internal RiSC cores use different number of bits before rounding in different CPU versions or platforms.