10 thoughts on “Why Does rnd() Keep Changing?”

  1. I agree with you that it’s a funny thing…. But I don’t think it’s right to mock the poor person who doesn’t understand the differences between round and random. It’s obvious that the person doesn’t know what he/she is doing and at least they’re asking for legitimate help in a fairly well respected knowledge board. Everyone has to start at the level of a basic “user/developer” Maybe a posting/direct e-mail would rectify that?

  2. Well actually, while i cant ascertain the exact function of the program, in some cases, using a rnd() function that doesn’t change is quite usefull. (as in has a fixed series of numbers)

    Just imagine when programming a 3D enviroment, using a rnd() value for the coordinates of trees for example. using a rnd() function (thats still random, but has a fixed order) you have a very effectient way of generating the same layout of trees every time you render the scene. I’m not sure how this works in ASP.NET, but in VB6.0 the rnd() function is predictable, and great for such things. If you really need to randomize, you could use something like randomize timer (so that every minute the sequence of numbers would change).

    It was one of the first things I learned about programming using random values: rnd() is NOT random, theres always some logic in it, because it is generated by a computer that cant just “by instinct of gut feeling” pick a number.

  3. Matt, I totally agree with that, you can seed rnd() so much that it gets to be as close to really random as is possible with a computer. I just wanted to point out that there are advantages to having a rnd() that is predictable

Comments are closed.