For the love of god, only call srand() once | MyNameIsTrez’ blog
One of the most common C mistakes I’ve seen is to call srand(time(NULL)); right before using rand() to generate a random number:
https://mynameistrez.github.io/2024/04/20/for-the-love-of-god-only-call-srand-once.html