How to generate a random integer number from within a range

后端 未结 11 1258
隐瞒了意图╮
隐瞒了意图╮ 2020-11-21 23:57

This is a follow on from a previously posted question:

How to generate a random number in C?

I wish to be able to generate a random number from within a part

11条回答
  •  面向向阳花
    2020-11-22 00:47

    Will return a floating point number in the range [0,1]:

    #define rand01() (((double)random())/((double)(RAND_MAX)))
    

提交回复
热议问题