I want to write a random number generator that generates a series of random float values between 0 and 1 (or alternatively a series of random integer value between 0 and 100). Given the same seed, it should generate the same series of values. The seed should be a long value.
The hard part is it needs to work in both Java and Swift/Objective C such that whichever language it is running it always produces the same series given the same seed. Pseudo-random numbers will do.
I have plenty of experience with Java so I could implement a random number generator translated from some C library but I would struggle to do the same in Swift and also keep the output consistent with type conversions and such. Is there a simple random number generator that would be fairly easy to implement for a beginner Swift developer? or a library that produces the same results on both platforms?
Thanks.
Aucun commentaire:
Enregistrer un commentaire