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.

40,026 questions

51,982 answers

573 users

How to generate random float number in Swift

1 Answer

0 votes
var number: Float = 0.0;
var i: Int = 0;
		
while (i < 20) {
    number = Float.random(in: 3.1...3.7)
	print(number);
	i += 1;
}	


	
	
/*
run:

3.3194036
3.6104078
3.2476056
3.5353007
3.1955671
3.4566092
3.4604268
3.534121
3.568839
3.6322582
3.2312262
3.1115732
3.190344
3.276145
3.6080515
3.5886664
3.221896
3.4291015
3.1756155
3.1655712

*/

 



answered Oct 14, 2021 by avibootz

Related questions

1 answer 93 views
1 answer 170 views
1 answer 94 views
1 answer 98 views
1 answer 87 views
1 answer 86 views
...