Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: FUBAR-BDHR on November 16, 2008, 02:08:45 am
-
Think I just found a new quark with rand-multiple (like there weren't enough of them already). It's acting like there is a finite range it will return from no matter how big the range you specify is. Basically the range is 800000 but it will only return values up to about 30000. Not sure what the max is but I never saw a result bigger that that.
Is there a limit to the range or value it will return?
-
My guess then would be that the max is 32768, or 2^15. That would leave on bit free for negative numbers when using 16 bits to store the numbers. Would have to look at the code to verify that, though.
-
Well I did try -400000 to 400000 before I tried 0 to 800000 but never got a value above -370000. If you can confirm that there is a maximum range can you add that to the description for the sexp?
-
As far as I can see the code is all ints. Not a single short in there so I can't see why it would be limiting itself to 16-bit values. Stick it in Mantis and assign it to me.
-
I would be interested more in the question, why random doesn't behave like it should.
Fubar knows the problem, since he is working on the mission in question.
Multiple Randoms in the same event seem to produce very similar results. Not exact results but close ones.
-
@Vid: Look at the problem I described. It's happening because it's only returning < 4% of the values it should be.
@Kara: http://scp.indiegames.us/mantis/view.php?id=1823 I'll get you the one example of this one in a few hours. The other might take a bit longer but we had a discussion about it on here before. I just need to dig up that test mission which could be named anything and be in any of 20 locations.
Found the thread anyway: http://www.hard-light.net/forums/index.php/topic,53198.0.html Can't believe the HLP search actually worked.
-
Okay. I know what's causing this. Solving it might be a whole different matter though. I'm going to post on the internal and see if the other coders have any ideas.
-
Remember even though I found the bug it's all Vid's fault since it was his mission. :D
-
isn't this weird?
If I encounter problems with an advanced effect I want to create, I always ask FUB (and done this frequently in the past). And in almost every case so far, it doesn't work because some kind of sexp bug. ;)
-
Well to be fair this isn't really so much the fault of the SCP or :v: so much as the idiotic way the random function works in C. :)
What's rather scary is recently most of the bugs I've investigated have resulted in me opening a rather big can of worms. This week has actually been rather calm in comparison. :)
-
/me Tosses Kara a fishing rod
Well since you have all those cans of worms might as well put them to good use. :D