Random and negative numbers

前端 未结 7 708
鱼传尺愫
鱼传尺愫 2021-01-17 14:52

I have to generate numbers in range [-100; +2000] in c++. How can I do this with rand if there is only positive numbers available? Are there any fast ways?<

相关标签:
7条回答
  • 2021-01-17 15:35

    Can you generate a number from 0-2100 and subtract 100?

    0 讨论(0)
提交回复
热议问题