I've been experimenting with random numbers and I've come to the conclusion either I'm a dumbass (entirely possible) or that random numbers are broken. I've attached a couple of .bas files to illustrate my problem:
This program takes a couple of variables, _cabbages and _potatoes and assigns them a value, adds them together and shows that number in the score.(100 potatoes + 50 cabbages = 150)
This works fine, so far so good.
I want to have one of the variables be a random number in stead of a defined value. (random # cabbages). I read the info on RT's site for random numbers so expected the syntax to be "a = rand" or "<var> = rand" (http://www.randomter...mands.html#rand)
So instead of _cabbages = 50, I use _cabbages = rand. I expected a random number between 0 and 255 , so my score would show 100 + whatever the random number is.
When I run my program, the score displays "206". Great! a random number!.
I run it again and it's still 206 and again, and again..It appears that for some reason, rand isn't generating a random number or I'm doing something wrong that I can't fathom.
Finally I tried moving the "rand" command into the main loop and triggered it with the fire-button. This seemed to work but the random numbers + the set variable were returning values outside of the range I expected.
I was expecting 100 + rand, so I was really confused as to how a variable with a value of 100 + (random number between 0 & 255) can equal a number < 100.
I'd appreciate it if one of the more experienced hands could put me out of my random misery