Random double values in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
2 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
Robert Atkins
Robert Atkins - avatar
+ 1
Divide rand() by 10^n, where n is the decimal.
11th Sep 2020, 3:08 AM
你知道規則,我也是
你知道規則,我也是 - avatar