+ 2

Random numbers in C

Is there any possibility of get a random number as output from a range of integers in C? Considering that the output are not static (e.g.: in a range [1,100] the first number is always 64)

29th Jun 2019, 1:52 AM
Henrique Sartori Siqueira
Henrique Sartori Siqueira - avatar
2 ответов
+ 6
using srand(time(NULL); rand()%100+1; will give you the desired result you need
29th Jun 2019, 7:18 AM
✳AsterisK✳
✳AsterisK✳ - avatar
14th Jul 2019, 7:31 AM
Alex Gyperkate
Alex Gyperkate - avatar