how can you have a random number generator in a function, and have it generate another random number each time the function is called within main()?

(when i tried, it would generate a different random number when the program is restarted, but each time the function is called in the program, it gives the same number).