C random integers on a raspberry pi, need seeding? – Programming – BleepingComputer

I’m developing a C program to run on a raspberry pi and get launched as it powers on. I need to get random integers in various ranges and have been using Value=rand() % 100; . These are not for cryptographic purposes so pseudorandom is fine and “predictable” random is ok, but by random I do expect that the values given should be different between each time the program runs, occasionally repeating as you’d expect with randomness, but not always the same value. And yet I think I’m getting the same random value every time? The Pi is not on the internet so the clock only updates by as much time as the pi is powered on for.

Does this random source end some sort of seeding or what? Doesn’t it like being called early after powerup?

Edited by rp88, Yesterday, 06:17 PM.

Leave a Reply

Your email address will not be published. Required fields are marked *