I am fairly new to IOS development, I am trying to use the swift double.random(in:).
this is the example from the documentation:
for _ in 1...3 {
print(Double.random(in: 10.0 ..< 20.0))
}
// Prints "18.1900709259179"
// Prints "14.2286325689993"
// Prints "13.1485686260762"
Here is my code, I am trying to generate random colors:
UIColor(red: Double.random(in: 1.0 ..< 251.0),
green: Double.random(in: 1.0 ..< 251.0),
blue: Double.random(in: 1.0 ..< 251.0),
aplha: 1);
But I keep getting the Error
Type 'Double' has no member 'random'
Aucun commentaire:
Enregistrer un commentaire