Random number generator

Options
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

  • erickpassos
    Options
    TSRandom is always seeded, so values are guaranteed to be the same in all clients...:)
  • Devis
    Options
    @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?
  • erickpassos
    Options
    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.