Discussion:
Random numbers and Endians
donJ
2017-12-08 00:20:00 UTC
Permalink
Hi,
I have an app that uses the Xojo random class with seeds to create
repeatable strings of pseudorandomly selected numbers. It worked fine
until I made a 64 bit version. A file saved on a 32 system bit does not
open correctly on a 64 bit system.
A little research indicates that this is due to the Random class
depending on Endianess.
So I think the simplest way to fix this is to find (or write) a random
method that does not depend on Endianess. Does one exist? Or can someone
point me to some information about it?

Thanks,

Don


To unsubscribe, email ***@xojo.com
Jean-Luc Arnaud
2017-12-08 09:32:17 UTC
Permalink
Maybe you could read the file in a MemoryBlock and change the Endian
property before rewriting it on disk?

Jean-Luc Arnaud
Post by donJ
Hi,
I have an app that uses the Xojo random class with seeds to create
repeatable strings of pseudorandomly selected numbers. It worked fine
until I made a 64 bit version. A file saved on a 32 system bit does
not open correctly on a 64 bit system.
A little research indicates that this is due to the Random class
depending on Endianess.
So I think the simplest way to fix this is to find (or write) a random
method that does not depend on Endianess. Does one exist? Or can
someone point me to some information about it?
Thanks,
Don
To unsubscribe, email ***@xojo.com
donJ
2017-12-08 13:51:54 UTC
Permalink
Hi Jean-Luc,
Thank you for the idea, but I think I am mistaken about the problem.
When I start with a new empty app, I get the same result on both
systems, so I need to investigate more,

Thanks for your time.
Don
Post by Jean-Luc Arnaud
Maybe you could read the file in a MemoryBlock and change the Endian
property before rewriting it on disk?
Jean-Luc Arnaud
Post by donJ
Hi,
I have an app that uses the Xojo random class with seeds to create
repeatable strings of pseudorandomly selected numbers. It worked fine
until I made a 64 bit version. A file saved on a 32 system bit does
not open correctly on a 64 bit system.
A little research indicates that this is due to the Random class
depending on Endianess.
So I think the simplest way to fix this is to find (or write) a
random method that does not depend on Endianess. Does one exist? Or
can someone point me to some information about it?
Thanks,
Don
To unsubscribe, email ***@xojo.com

Continue reading on narkive:
Loading...