rand() generating the same number – even with srand(time(NULL)) in my main!

后端 未结 7 629
执念已碎
执念已碎 2020-11-28 15:49

So, I\'m trying to create a random vector (think geometry, not an expandable array), and every time I call my random vector function I get the same x value, though y and z a

相关标签:
7条回答
  • 2020-11-28 16:37

    I had the same problem exactly. I fixed it by moving the srand() call so it was only called once in my program (previously I had been seeding it at the top of a function call). Don't really understand the technicalities - but it was problem solved.

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