Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,870 questions

51,793 answers

573 users

How to generate a random double number between 1 and 10 in Swift

1 Answer

0 votes
import Foundation

for _ in 0..<25 {
    let randomNumber = Double.random(in: 1.0...10.0)
    print(randomNumber)
}



/*
run:

7.400546237071137
4.536755819955087
4.829198990538326
3.5310342877610768
2.7623550131795653
6.63200926406042
3.9516472875007613
5.947390374323049
9.183031939695539
5.227808302394851
6.355346168794757
7.41768441771026
8.640196031384749
5.42203867628184
4.152590588491266
2.055183416626567
5.045697067770628
8.799605020035674
5.953958119773376
1.2628944851457924
3.970742683555476
7.890899081778186
9.749850292175278
4.818961978105444
6.71372479548807

*/

 



answered Nov 11, 2024 by avibootz

Related questions

1 answer 91 views
1 answer 86 views
1 answer 169 views
1 answer 94 views
1 answer 177 views
2 answers 149 views
...