+ 1

Random double values in C

How to generate random double numbers in C? (Number like 12.38392)

11th Sep 2020, 2:42 AM
Krishan Shamod
3 Answers
+ 1
https://www.geeksforgeeks.org/rand-and-srand-in-ccpp/ Give this article a read through, It return a random integer but you could cast to double if you desire.
11th Sep 2020, 2:55 AM
StealthyTaco
StealthyTaco - avatar
+ 1
Divide rand() by 10^n, where n is the decimal.
11th Sep 2020, 3:08 AM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar