vendredi 29 mars 2019

Need explanation about random function swift

Got a question about my random function: why is it giving this error?

'4294967295' is not exactly representable as 'Float'; it becomes '4294967296'

-

my code is

func random() ->CGFloat {
    return CGFloat(Float(arc4random()) / 0xFFFFFFFF)
}
func  random(min: CGFloat, max: CGFloat) -> CGFloat {
    return random() * (max - min) + min
}

it doesn't change the functionality of the application but it just appeared out of nowhere.

thanks in advance!




Aucun commentaire:

Enregistrer un commentaire