Powered by Jitbit .Net Forum free trial version.
the topic is closed | show rated messages only

HomeFallen London » The Bazaar

This is the place to discuss playing the game. Find tips, debate the best places to find certain items and share advice.

Why is math so wrong? Messages in this topic - RSS

kaqqao
kaqqao
Posts: 22

9/1/2013
Example: I managed to fail a 58% challenge 11 consecutive times. The chances for this happening are 0.00717%. I don't think anyone is this unlucky. Something must be horribly wrong with the math in the game.
Do you have similar observations?

  • edited by kaqqao on 9/1/2013

    --
    kaqqao in Fallen London
  • 0 link
    Diptych
    Diptych
    Administrator
    Posts: 3415

    9/1/2013
    There are so many random rolls in this game, all day, every day, that, honestly, a pattern not far removed from tossing heads eleven times in a row is bound to pop up sooner or later.

    --
    Sir Frederick, the Libertarian Esotericist. Lord Hubris, the Bloody Baron.
    Juniper Brown, the Ill-Fated Orphan. Esther Ellis-Hall, the Fashionable Fabian.
    0 link
    serguma
    serguma
    Posts: 65

    9/1/2013
    That is how randomness works.
    The chance to fail doesn't decrease each time, you have the same chance to fail after each consecutive attempt.
    But well, while the chances for that exact combination (11 times in a row) are low, consider this:
    If we simplify things and assume a 50% success chance, the odds of failing 11 times in a row are the same as the odds of failing 10 times in a row and then succeeding one, or for that matter any UNIQUE combination of successes/failures.
    But yes, I get it can be frustrating, I just failed a similar number of times in a row.

    --
    http://fallenlondon.storynexus.com/Profile/serguma
    +1 link
    Flyte
    Flyte
    Administrator
    Posts: 671

    9/1/2013
    That's about one chance in a hundred thousand. Do you play often? If so, how many notable patterns of failure and success with probabilities on the same order of magnitude have not happened to you? Probably, a great many. (I have runs of awful luck, too, and of implausible good fortune; somehow I'm always more inclined to rage about the former than to celebrate the latter.)

    Also, I recently read that Fallen London has something like 20 000 monthly players; that's enough to render probable pretty horrible misfortunes for a few cursèd individuals. We are all Adrift on a Sea of Misfortune.

    Well, I'll send you something nice; I may not have an Overgoat, but I am yet a gentleman whose circumstances are not entirely straitened; and is this not a charitable (if somewhat rubbery and hell-touched) age?
    0 link
    Hanon Ondricek
    Hanon Ondricek
    Posts: 417

    9/1/2013
    serguma wrote:
    That is how randomness works.
    The chance to fail doesn't decrease each time, you have the same chance to fail after each consecutive attempt.
    But well, while the chances for that exact combination (11 times in a row) are low, consider this:
    If we simplify things and assume a 50% success chance, the odds of failing 11 times in a row are the same as the odds of failing 10 times in a row and then succeeding one, or for that matter any UNIQUE combination of successes/failures.
    But yes, I get it can be frustrating, I just failed a similar number of times in a row.



  • This is very very true. Many people think of any set of attempts as cumulative, and the more attempts they make, the more likely it is they will succeed. This is ostensibly valid over a large enough set of attempts, but yes -- a second attempt after a first attempt has no more likelier a chance of succeeding.

    I worked in a casino, and I often had to attempt to explain this type of concept to customers who saw our posted average 98% payout rate (which was true - 98 percent of the money taken in from gambling was paid out to winners) and assumed they were supposed to win twice out of 100 tries, or that if they spent $100 they would win back $98 of it. 98% was paid out...but not to everyone. And not every machine had a 98% payout, that was the average of the machines' payout rates. The best way I could explain it is "The casino has no memory of who you are. Every time you pull that lever you have the same chance of succeeding or failing." And it's easily possible to have a run of bad luck.

  • edited by HanonO on 9/1/2013
  • 0 link
    Ewan C.
    Ewan C.
    Posts: 675

    9/1/2013
    My 'favourite' current example is a specific 'this could go either way' that I have been unlucky on each and every of the thirteen times I've tried it so far. p=0.0001220703125, or around one in ten thousand - given how many separate branches and how many players there are, just not a big deal (despite being annoying!)
    0 link
    kaqqao
    kaqqao
    Posts: 22

    9/12/2013
    While I am quite familiar with the selection bias that you're all referring to, I am not ready to believe it to be the case here, as I've *never* so far had 10+ consecutive *successes* in anything with probability below 85% or so. Instead, I think there's either a hidden factor or the pseudorandom number generator used for the game could have a better implementation.
    Of course, I might also just be unlucky.

  • edited by kaqqao on 9/12/2013

    --
    kaqqao in Fallen London
  • 0 link
    Flyte
    Flyte
    Administrator
    Posts: 671

    9/13/2013
    kaqqao wrote:
    I've *never* so far had 10+ consecutive *successes* in anything with probability below 85% or so. Instead, I think there's either a hidden factor or the pseudorandom number generator used for the game could have a better implementation.
    My honest response is one of the following:
    1. Your luck is genuinely terrible, but this is nothing to do with Fallen London. You are being punished because you recited the Diamond Sutra with insufficient frequency in your previous lives. I urge you to walk the eightfold path, before you are incarnated as a sheep or flesh-eating toad oracle.
    2. I ate a raw octopus while muttering imprecations against you (backwards and in Korean, although these things were optional, and really only done as a homage to Pink Floyd and Park Chan-wook). This allowed me to steal your luck, which however turned out to be terrible, for the reason given above. I would be grateful if you would take it back by the most expeditious means at your disposal.
    3. The Fallen London random number generator has been compromised by the NSA, for reasons of national security. Failbetter know this, but have of course been silenced. As evidence, I adduce the absence of references to pressure cookers or fertiliser in Fallen London, which lack, as I firmly believe, impinges on the awareness of perspicacious players every day.
    4. The odds of succeeding ten times in a row on an 85% challenge are nearly one in five, and you have probably done so several times without noticing. Failbetter's RNG is almost certainly adequate and impartial, and has not been incited against you by a rogue intern or the first gloamy gleam of a new machine malevolence.

    edited by Flyte on 9/13/2013
    +11 link
    Alexis Kennedy
    Alexis Kennedy
    Posts: 1374

    9/13/2013
    The random number generator we use is the bog-standard C# one (System.Random). We do absolutely nothing unusual with it, and there are hundreds of thousands of other applications over two decades that use it in the same way. If that maths is broken, it's the fault of either Microsoft, God or physics. (There was a time when the first two were much more similar entities, but that time is long past.

    So, I'm sorry: you've just been unlucky. The only thing I can add to the excellent. explanations below is to say, think of it this way: there are something like fifty million of these rolls made every month. If that didn't throw up some streaks of appalling luck, then it would be a remarkably benign RNG. I get about one mail every two months on this: you're not alone.

  • edited by Alexis on 9/13/2013
  • +3 link
    xKiv
    xKiv
    Posts: 830

    9/13/2013
    Alexis Kennedy wrote:
    The random number generator we use is the bog-standard C# one (System.Random). We do absolutely nothing unusual with it, and there are hundreds of thousands of other applications over two decades that use it in the same way. If that maths is broken, it's the fault of either Microsoft, God or physics. (There was a time when the first two were much more similar entities, but that time is long past.


    As long as you keep the RNG state across pageloads (at least within one session), and don't rely on it auto-initializing every time (since it, by default, seeds from something dependent on current time, which doesn't have very good statistical properties) wink
    I have no idea how coarse that default seeding is in time (milliseconds, seconds, ...) or application scope (one page, one login-logout session, entire application).

    --
    https://www.fallenlondon.storynexus.com/Profile/xKiv - a witchful, percussive, dangermous and shadowry scholar of coexplodence, hopsidirean, and walker of fallen kitties.
    0 link
    Theus
    Theus
    Posts: 311

    9/13/2013
    in order to do that, you have to keep your Random object in memory with an open reference, or you write your seed to the database. Neither of these things are as desirable at scale as instantiating new at run-time and letting IIS munch through your discarded objects. What does make sense is the same object for a single click. I.e. a multi-stat check on a single action. That way you avoid the risk of getting 2 objects with the same seed causing your this.next() to return the same number.

    --
    http://fallenlondon.storynexus.com/Profile/Hefty~Harrison
    0 link
    babelfishwars
    babelfishwars
    Administrator
    Posts: 1138

    9/13/2013
    I look at the post above. I see words. WORDS. But the words. They make no sense. SENSE?

    --
    Mars, God of Fish; Leaning Tower of Fish
    0 link
    Alexis Kennedy
    Alexis Kennedy
    Posts: 1374

    9/13/2013
    In the interests of transparency I've pasted the relevant code snippet below. I trust this will reassure everyone involved and end the matter.



  • originalResult=Random.Next(lowerBound,upperBound+1);


    return MischievouslyAlterResult(originalResult, GlobalMalevolenceLevel, NSAInstructionSet, User.NexPurchasedInLifetime,User.HasEverComplainedOnTwitterAboutMe);
  • +17 link
    Spacemarine9
    Spacemarine9
    Posts: 2234

    9/13/2013
    Oh, come on. That's obviously not the real code snippet.

    It's missing the reference for the prototype sentient AI which analyses your current position and gives you the result which would be least convenient. Don't think I don't know about it.

    --
    my rats will blot out the sun
    Ratgames
    FL lore/mechanics questions and answers
    #FallenLondon IRC (irc.synirc.net) Channel! Click to join via Mibbit.
    #SunlessSea IRC channel! Like the above, but zee-ier.
    +1 link
    Diptych
    Diptych
    Administrator
    Posts: 3415

    9/13/2013
    I'm amazed that Alexis left out the code referencing the rat counter. And that Spacemarine9 left out mentioning being amazed that Alexis left out the code referencing the rat counter.

    --
    Sir Frederick, the Libertarian Esotericist. Lord Hubris, the Bloody Baron.
    Juniper Brown, the Ill-Fated Orphan. Esther Ellis-Hall, the Fashionable Fabian.
    +3 link
    xKiv
    xKiv
    Posts: 830

    9/13/2013
    So, no persistent rng state - and therefore no (guaranteed) statistical properties.
    (still good for when you just want unpredictability, not good if you want something to happen with a given chance).
    Just because almost nobody actually understands these issues (and "everybody" claims that it's okay this way because everybody does it that way) doesn't mean that it's working as intended.
    Not that I claim to know how FBG intends to use its random number god.

    EDIT:
    Theus wrote:
    That way you avoid the risk of getting 2 objects with the same seed causing your this.next() to return the same number.


    This doesn't make sense. You store the RNG state (a few (dozen?) bytes) with the rest of the player's state (many more bytes already), so if you are repeating the same seed, you are repeating everything. If anything, it would be safer - it would close any potential hypothetical "save/load/retry" type exploits..
    edited by xKiv on 9/13/2013

    --
    https://www.fallenlondon.storynexus.com/Profile/xKiv - a witchful, percussive, dangermous and shadowry scholar of coexplodence, hopsidirean, and walker of fallen kitties.
    0 link
    Theus
    Theus
    Posts: 311

    9/13/2013
    xKiv wrote:
    This doesn't make sense. You store the RNG state (a few (dozen?) bytes) with the rest of the player's state (many more bytes already), so if you are repeating the same seed, you are repeating everything. If anything, it would be safer - it would close any potential hypothetical "save/load/retry" type exploits..


    The player's "state" is a row in a database. This exists on a distinct server (more likely than not replicated to one or more others, but think of it logically as existing in one place). The "RNG State" is a system object that exists within memory on the webserver. The webserver creates this object from consulting the system clock and is able to use this object to spit out values without needing anything from the database.

    This is different from a client-side game where everything is (virtual) memory. Everyone's (web)clients get the information from the webservers who get player information from the database. A client cannot seed their own RNG or futz with the value. The closest you can get is estimate your transmission time and script your client execution to attempt to hit a certain timestamp, but as the outputs can vary across .NET frameworks, that's not necessarily worth your time either.

    Furthermore, when you scale up to handle thousands of concurrent users on the webservers, you don't ask them to touch the database with information that does not need to be persisted.

    I'm not a mathematician, so I can't play probabilistic tennis. (Probaballistic!) It is kinda accepted though that you can trust Knuth on this one.

    More details from MS: http://msdn.microsoft.com/en-us/library/system.random.aspx

    --
    http://fallenlondon.storynexus.com/Profile/Hefty~Harrison
    0 link
    babelfishwars
    babelfishwars
    Administrator
    Posts: 1138

    9/13/2013
    Sir Frederick Tanah-Chook wrote:
    I'm amazed that Alexis left out the code referencing the rat counter. And that Spacemarine9 left out mentioning being amazed that Alexis left out the code referencing the rat counter.


    I think we've all agreed not to talk about that after the ... incident ... with the ... in the ... with ... and then the SCREAMS MY GOD THE SCREAMS you know what I mean?

    --
    Mars, God of Fish; Leaning Tower of Fish
    0 link
    xKiv
    xKiv
    Posts: 830

    9/13/2013
    Theus wrote:
    The player's "state" is a row in a database.


    And also an object (or several objects) in the server's memory, any time it's being actually used. If it's never in the server's (application) memory, it can never be used by the game.
    (it doesn't have to be there all at the same time, but each part of it has to be there at some time, except useless parts, and parts that are only useful for database-level chicanery - you generally don't want to do your application stuff on databases, even the ones that can handle it, you can end up with very long and confusing SQL statements that way)

    Theus wrote:
    The "RNG State" is a system object that exists within memory on the webserver. The webserver creates this object from consulting the system clock

    The important thing here is ... is this a new object created every time you access a page, new object for every user session, one per server thread (and reused for many pages/sessions), one per server thread (and not reused much because the server doesn't really reuse old threads for new requests) or one per server (and reused for everything, until somebody restarts the server)?

    Theus wrote:
    The webserver creates this object from consulting the system clock

    This is something that should really happen only once. The more times you seed from clock, the more you move from well-behaved RNG towards "doesn't do what you think it does".

    Theus wrote:
    and is able to use this object to spit out values without needing anything from the database.

    You have to consult the database at the start of any request (unless you store everything on session), and also at the end of most request (to update current player state). Reading one more value at the start and storing that one more value at the end won't hurt performance that much. Bottleneck is still probably internet speed between server and browser.

    Theus wrote:

    It is kinda accepted though that you can trust Knuth on this one.

    AFAIK Knuth didn't say to use rand() for probabilistic stuff, just randomization.
    edited by xKiv on 9/13/2013

    --
    https://www.fallenlondon.storynexus.com/Profile/xKiv - a witchful, percussive, dangermous and shadowry scholar of coexplodence, hopsidirean, and walker of fallen kitties.
    0 link
    Alexis Kennedy
    Alexis Kennedy
    Posts: 1374

    9/14/2013
    This is now a conversation of rather specialised interest and it's taking over the board. Take it to PMs, folks, please! (I will say that Theus' assumptions about performance issues are broadly correct, but I don't want to get drawn on details.)
    0 link




    Powered by Jitbit Forum 8.0.2.0 © 2006-2013 Jitbit Software