Author Topic: Rand-multiple take 3  (Read 2285 times)

0 Members and 1 Guest are viewing this topic.

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
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? 
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline Shade

  • 211
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.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
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? 
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
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.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Vidmaster

  • 211
  • Inventor of FS2 bullettime ;-)
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.
Devoted member of the Official Karajorma Fan Club (Founded and Led by Mobius).

Does crazy Software Engineering for a living, until he finally musters the courage to start building games for real. Might never happen.

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
@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.
« Last Edit: November 17, 2008, 02:38:12 pm by FUBAR-BDHR »
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
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.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Remember even though I found the bug it's all Vid's fault since it was his mission.   :D
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline Vidmaster

  • 211
  • Inventor of FS2 bullettime ;-)
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.  ;)
Devoted member of the Official Karajorma Fan Club (Founded and Led by Mobius).

Does crazy Software Engineering for a living, until he finally musters the courage to start building games for real. Might never happen.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
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. :)
« Last Edit: November 19, 2008, 01:56:26 am by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

  

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
* FUBAR-BDHR Tosses Kara a fishing rod

Well since you have all those cans of worms might as well put them to good use.   :D
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras