Work in progress: 181,232 of 181,233 sites checked so far, more every week · updated 2 Nov 2026Missing a blog? Tell us

Top all-time · #18460

F

fuglede.dk blog (dansk udgave)

Personal blog · fuglede.dk/en/blogprogrammingmath

fuglede.dk blog (dansk udgave) is a personal blog at fuglede.dk about programming and math. Since 2017, 4 different Hacker News readers have linked it 7 times, most often “Hunting for statistical bias in the .NET RNG”. The last post was in 2021, but the archive is still widely read.

Visit the blog
7mentions?
4HN people?
2017–2024first – last linked?
Links on Hacker News per year · peak 2 in 2023

Too few sampled comments (4) to say how often HN recommends it.?

Why HN links it

HN readers link this blog for its analysis of bias in the .NET Framework System.Random.Next() method, caused by integer-to-float conversions. It is cited in discussions of RNG flaws and their effects.

Summarised by Claude from a sample of 4 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.

Most-linked posts?

  1. Hunting for statistical bias in the .NET RNG
    4 people · 4 mentions · first linked 2017-08-27

What Hacker News says?

  1. Just for curiosity sake, I looked at the standard RNG in C# and it is indeed flawed, but probably not enough to be seen unless you are doing formal tests. In [1] it says that numbers have a 0.5034 probability of being odd due to rounding errors in the algorithm that picks a number in a range, which is unacceptable for a simulation, but may actually be better than a real coin toss [2]. The raw RNG is also flawed but…

    Comment linking /en/blog/bias-in-net-rng/

    on “How random is xkcd? (2015)”
  2. Submitted When redundant type casts matter in C# as a story · 3 points

    HN discussion
  3. One I remember stumbling upon some years back was the .NET Framework equivalent of that, System.Random.Next(0, int.MaxValue), which has a much greater probability of producing odd numbers than even numbers, the probability of getting odd numbers being 50.34%, because of some rather unfortunate translations between integers and floating points. https://fuglede.dk/en/blog/bias-in-net-rng/

    Comment linking /en/blog/bias-in-net-rng/

    on “How random are TOTP codes?”
  4. Submitted Hunting for statistical bias in the .NET RNG as a story · 3 points

    HN discussion
  5. japanuspus · 2018-08-28Recommends
    The blog-post by fuglede with a detailed analysis of the implications of the RNG-bug is well worth a read: https://fuglede.dk/en/blog/bias-in-net-rng/

    Comment linking /en/blog/bias-in-net-rng/

    on “Randomness in .NET”
  6. Submitted An infinite parking garage: From topology to Python as a story · 2 points

    HN discussion
  7. Heh, I remember running into something similar professionally, using the .NET Framework to generate random numbers: When asked to generate random integers, it has a seemingly innocent conversion from integers to floating points and back that ends up causing significant bias on large ranges. Specifically, `Random.Next(b)` produces an integer between 0 and b - 1 by 1. taking a random integer between 0 and 2^31 − 2, 2.…

    Comment linking /da/blog/bias-in-net-rng/

    on “The Wi Flag -Turns out some players in Asheron's Call were born unlucky”

Search all of HN for fuglede.dk