I want to have something to happen when (-1)^k is 1 and when its -1 -> k is generated randomly.
I tried this but it doesnt work
let test:Int32 = -1
let leftOrRight:CGFloat = pow(CGFloat(test),random(min:0,max:1))
func random(min : CGFloat, max : CGFloat) -> CGFloat{
return random() * (max - min) + min
}
leftOrRight is always NaN :(
I appreciate any help :)
Aucun commentaire:
Enregistrer un commentaire