Jump to content

Random not very random


Odessa

Recommended Posts

I've tested GetRandomPercent and Rand 0 100 hundreds of times (yes, hundreds, across multiple games and frames), with results printed to console. It seems to generate numbers in the upper range significantly more often than in the lower. As a vague guess values > 25 are seemingly 2 or 3 times more likely than would be expected.

 

Has anyone else come across this or know some kind of workaround?

 

I can do Rand 0 X * GameDaysPassed / 28 ... to base it on phases of the moon.. which might be an interesting gameplay dynamic.. but makes things rather worse if I need 10 random numbers during the same frame

Link to comment

I have this problem all the time with dialogue. Ie, check the "random" box, and watch the top dialogue lines (the first you write) come up far more often than those at the bottom. My solution is to usually compensate by writing more copies of the lines at the bottom to stack the odds, so to speak.

 

I'm not sure what you'd be able to do about it script-wise though. Maybe have abnormally higher values than you otherwise would for what is supposed to be a random number?

Link to comment

I've tested GetRandomPercent and Rand 0 100 hundreds of times (yes, hundreds, across multiple games and frames), with results printed to console. It seems to generate numbers in the upper range significantly more often than in the lower. As a vague guess values > 25 are seemingly 2 or 3 times more likely than would be expected.

 

Has anyone else come across this or know some kind of workaround?

 

I can do Rand 0 X * GameDaysPassed / 28 ... to base it on phases of the moon.. which might be an interesting gameplay dynamic.. but makes things rather worse if I need 10 random numbers during the same frame

What issue would you have with rand ?

 

Also I am pretty sure GetRandomPercent is engeneered to return the same value if called in the same script for the same frame. Otherwize using in idle animation selection would be pointless.

 

Link to comment

 As a vague guess values > 25 are seemingly 2 or 3 times more likely than would be expected.

 

With getrandompercent evenly generating numbers between 0-99, isn't it actually expected that in 3 of 4 cases the number will be >=25 (ideally)?

Yes, obviously, by 'than would be expected' I mean in a relative individual number basis, I suppose a better way of putting it is that the distribution of numbers returned from GetRandomPercent or Rand is consistently uneven.

 

I know random does not mean even distribution unless taken to infinity, but I have tested this hundreds of times across multiple frames and games and it is consistently significantly skewed- I am printing the actual values, this isn't just a feeling.

 

@ jaam, I thought that might be the case, but it does give different results within the same frame, I am generating 6-10 in the same script and they are all different.

Link to comment

@CK: Do you always use random ends?  And do you you notice a difference with them in or out?

 

Yes, and no. I first noticed it when I was doing some lines for Loogie's Legion and noticed for some reason, some lines popped up far more often than others. Then again, I don't think the GECK was designed to handle the sheer number of "randoms" I was putting in, as most the vanilla game handles are like those "run for rumours" that have like 5-6 variations while I was putting in more than a dozen in Legion/PG and over 20-30 in SexoutSex.

Link to comment

@ Odessa: Well, I'm not saying that it might not be broken, which it very well may be, but with only several hundred "rolls" and a range from 0-99, the variance would still allow the result to be in the dimension you describe. 1 in 4 "wins" are expected, but only guaranteed for infinite tries.

 

Regardless, even if that is not the case here and it is indeed broken, maybe there is the possibility that the getrandom somehow includes the player luck stat and somehow pushes the results in one direction or another. 

Link to comment

 

@CK: Do you always use random ends?  And do you you notice a difference with them in or out?

 

Yes, and no. I first noticed it when I was doing some lines for Loogie's Legion and noticed for some reason, some lines popped up far more often than others. Then again, I don't think the GECK was designed to handle the sheer number of "randoms" I was putting in, as most the vanilla game handles are like those "run for rumours" that have like 5-6 variations while I was putting in more than a dozen in Legion/PG and over 20-30 in SexoutSex.

 

 

Makes sense.  I often thought random picked the top more often than the bottom in the sound replacer mod, which stacks a lot of entries before it picks one.  I always thought it was my imagination.

 

Link to comment

I made a quest that calculated 1000 getrandompercents in a loop per second, then one that did 100,000 in a single loop, then one that added 100 objects per second which each did 1.

 

Based on the returns, I incremented one of ten vars for < 10, < 20, < 30 < .... < 100

 

In all cases the distribution was normal. Perhaps it was just in my head, unless something unknown affects the function

Link to comment

I have this problem all the time with dialogue. Ie, check the "random" box, and watch the top dialogue lines (the first you write) come up far more often than those at the bottom.

 

I noticed it very often, it's annoying. The only thing I thought is that it wrongly makes a random choice following how dialogues and packages usually work, from top to bottom. i.e. first line: should I display or not? if not, second line: yes or not? if not, third line, etc. etc. everytime making a 50% of possibilities.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use