Giter VIP home page Giter VIP logo

Comments (7)

ArtemGr avatar ArtemGr commented on June 12, 2024

Thanks for the heads up.

The seed is /dev/urandom, according to the docs (https://github.com/rust-lang-nursery/rand). It should be good enough.

What I might be missing is reusing a generator instance instead of just spamming a static function.

I'll see if I can reproduce this.

from sidekick.

ArtemGr avatar ArtemGr commented on June 12, 2024

you can never be sure

from sidekick.

ArtemGr avatar ArtemGr commented on June 12, 2024

and every batch of rolls had 5+ such streaks

So I did a small test

  let mut streaks = BTreeMap::new();
  for _ in 0..99 {
    let mut longest_streak = 0;
    let mut streak = 0;
    let mut prev = 0;
    for _ in 0..99 {
      let r = roll (10);
      if r == prev {streak += 1; if streak > longest_streak {longest_streak = streak}} else {prev = r; streak = 0}}
    *streaks.entry (longest_streak) .or_insert (0) += 1}
  println! ("Streaks: {:?}", streaks);
  // Streaks: {1: 34, 2: 58, 3: 6, 4: 1}

and I can't I reproduce the phenomena. The number of streaks I encounter looks normal to me.

Here's another one to show there's no bias:

  let mut map = BTreeMap::new();
  for _ in 0..99999 {*map.entry (roll (10)) .or_insert (0) += 1}
  println! ("Spread: {:?}", map);
  // Spread: {1: 9962, 2: 10012, 3: 9990, 4: 9994, 5: 9960, 6: 10191, 7: 9922, 8: 10123, 9: 9853, 10: 9992}

Cursory examination of the logs doesn't give anything either.


Now, it's not a crime if the random number generator produces the same number now and then. Such streaks stand out to our perception but they are in no way a proof of poor randomness.

I would like to, but I didn't have the time to go over the tests in https://www.random.org/analysis/ (I have, in fact, downloaded and compiled the NIST test suite, but it's command line interface is lacking in user-friendliness and can't be used without digging further into the sources and/or the paper).

On a side note I'd like to mention "A Basic Introduction to Probability" section in the Angry's article.

And a funny scene from "Rosencrantz and Guildenstern Are Dead", a film by Tom Stoppard.

from sidekick.

ArtemGr avatar ArtemGr commented on June 12, 2024

To quote Angry: "In essence, probability about determining the chance of a given outcome of an event. But that probability doesn’t erase the fact that the event is random. You might have a 95% chance of hitting the goblin on your next attack roll, but that doesn’t mean you can’t roll a 1. And it might be very unlikely, but you can roll three 1s in a row.

You can design a system wherein the players will succeed on 80% of their actions, but any given action might succeed and it might fail and any player might get a run of really bad or really good luck. The outcomes are still random.

When an individual player talks about probabilities, they usually want to know the chance of getting a specific outcome. What’s the chance I’ll roll a 15 for my Strength score if I roll 3d6? If I roll 4d6? What’s the chance I’ll get a 10 or above? What are the chances I’ll manage to kill this goblin this round? And the problem with those questions is that they are talking about a SINGLE EVENT.

When game designers talk about probabilities, they want to know how lots and lots of die rolls are going to come out. If I make my system work like this, how often will the players succeed? How likely is this rule to kill a PC? If the PCs have this stat and the monsters have that stat, how often will the PCs win a fight? And THOSE questions are what probability was really meant to do."

from sidekick.

ArtemGr avatar ArtemGr commented on June 12, 2024

FYI, https://www.reddit.com/r/rust/comments/87qy40/history_of_the_rand_crate/

from sidekick.

ArtemGr avatar ArtemGr commented on June 12, 2024

https://en.wikipedia.org/wiki/Clustering_illusion: The clustering illusion is the tendency to erroneously consider the inevitable "streaks" or "clusters" arising in small samples from random distributions to be non-random.

from sidekick.

ArtemGr avatar ArtemGr commented on June 12, 2024

“Finally, psychologists have demonstrated that humans have a very poor intuitive understanding of randomness. We struggle to comprehend the fact that HHHHH is just as likely an outcome of five coin tosses as HTHTT. This seems to be the source of a whole range of biases impacting our decision-making.”
“Sometimes randomness conspires in our favor, sometimes against us”
https://www.menimagerie.com/manuscripts/2018/6/9/viii-bayes-and-brains

from sidekick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.