Hello to everyone who sees this post!

I am not very experienced in programming, but I have some basic knowledge, and the first real programming language I happen to learn is Dev Pascal. I have compiled a program which generates random numbers, using the RANDOM(); function. It is actually a dice roller.

The thing is, that every time I run the program, I get the same sequence of numbers. For example, if I run the program and get 4, 2, 1, 6, the next time I run the program, I will get again 4, 2, 1, 6!

I have searched the Web and found out that this problem is due to the mathematical expression the RANDOM(); function uses, and this makes it "generate" the same numbers every time it runs again, as the "seed", the initial value of the number it uses, is the same. But those ARE NOT random numbers!

If there is anyone who can help me find a better way to generate REALLY random numbers, please, do so! I don't know if there is the possibility to get clock values in Dev Pascal, and if there is, how to use it... Any help will be appreciated. PLEASE HELP ME!!! PLEASE!!! :sad:

Thank you, Jackrabbit! It really worked!
The error was the missing Randomize; in the beginning. I had the same seed every time, thus getting the same sequence of numbers! Thanks again!
Actually, I found the answer myself, just a few minutes after I posted that... in another website... But the thought and only is worth it! thank you!

This article has been dead for over six months. Start a new discussion instead.