EDIT: NEVERMIND... I've realized that Random is indeed producing random numbers. My code, however, is not. Sorry about that.
So I did a search, and there are (of course) quite a few posts on the well-known Random() bug. Now, correct me if I'm wrong, but wasn't it fixed a while back?
Turns out I'm getting a suspiciously similar result from a bunch of random number generations, and I'm wondering if it's not fixed.
Err... so was it fixed?
Thanks.
-l
Posted on 2005-03-02 14:34:44 (last edited on 2005-03-02 14:55:03)
I think there still is a crash bug when you pass in a negative number in the second argument and a larger number in the first argument. It doesn't always crash sometimes it returns junk,
Random, as far as I can tell 'works as intended' now.
What that means is as follows.
If I do SetRandSeed(1) and call Random() 50 times, I will get the same 50 numbers each time. That's intended.
If I do SetRandSeed(0), then the seed will be set to a 'random' value based on the system time - you should get different values each time.
As far as I know, the random seed is initialized randomly when verge.exe starts up. But I'm at work and dont have the code handy.
Edit: any non-zero seed will be considered a 'fixed' seed. Passing 0 specifically tells it to use a timer-based seed.
Yep. It's working perfectly. I usually SetRandSeed(systemtime), as I am now, and it works like a champ. That explanation should go in the Docs for SetRandSeed, btw.
My problem was a loop that kept resetting what I wanted to make random. Bugger of a bug, I must say.
I think there still is a crash bug when you pass in a negative number in the second argument and a larger number in the first argument. It doesn't always crash sometimes it returns junk,
Random() is meant to always have the first number be less than the second.
Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.