I'm looking for an efficient method of generating large numbers (that includes floating point types!) in Swift, with arbitrary ranges (which may even be UInt.max or Int.max)
All the existing questions I've seen either crash for large values (UInt.max) or don't support ranges. I know that you can read from /dev/urandom for random bytes, but that doesn't help restrict these values to a given interval (and I'm pretty sure looping until it does isn't efficient).
Aucun commentaire:
Enregistrer un commentaire