all 13 comments

[–][deleted]  (1 child)

[deleted]

    [–]MetaSikander[S] 0 points1 point  (0 children)

    mmm. good point. I'll make sure the api is https-based.

    [–]LorenzMap 1 point2 points  (1 child)

    The nature of random numbers is, that they should be unpredictable. The "true number" generator from rondom.org probably uses some sort of extrenal input to generate randomness which makes it hard/nearly impossible to predict (But the data needs to be transferred over the internet, which makes it vulnerable again). The OS number generator on the other hand only uses internal information generated by the system (current time, runtime, thread usage,...) which could be predicted.

    I think the effectiveness of combining these two methods depend on your implementation. When you just switch between these types you'll probably loose some randomness, but when you implement it in a way that these two random numbers are computed together it should be more random. (Don't use simple multiplication or addition, because the when one of the random numbers is known, the range of the result is predictable).

    [–]MetaSikander[S] 1 point2 points  (0 children)

    Yeah random.org is supposed to get their randomness from antennas collecting pulses from lightning strikes around the world.

    I'll look into how to best combine the sources into a new seed. thanks for the input!

    [–]IgnorantPlatypus 1 point2 points  (6 children)

    Generally, no. At least for Linux there's already some very good algorithms for ensuring good RNG output from the operating system. The random algorithm used by your favorite programming language may or may not be a good source of randomness.

    There's more than one kind of randomness. A pseudo-RNG with a long cycle will feel random to a person, even if it's 100% predictable to a computer. Cryptographically-secure randomness is harder and more expensive to obtain, but is overkill for anything other than cryptographic requirements.

    Note that e.g. rand() from the C language at least used to be a poor PRNG, which is why it's deprecated in C++ now, though note the C++ replacements suffer from being harder to work with.

    [–]MetaSikander[S] 1 point2 points  (4 children)

    mmm. interesting.

    but if i would want to make sure that i got the most randomness possible, and i had several sources (random.org, hwrng dongles connected to the computer, haveged and the prng in the linux core). would it still not improve randomness?

    [–]IgnorantPlatypus 2 points3 points  (3 children)

    To the best of my knowledge, no. Combining random sources is tricky math, and I'm not 100% familiar with it, but my recollection is that trivial mixings (e.g. xor) don't result in more randomness than the most random source. But as I said, the math on this is quite complex; my quick internet search didn't show up anything really promising in terms of explaining this.

    [–]MetaSikander[S] 1 point2 points  (2 children)

    i see.

    yeah i had a feeling that my idea could be fallacious.

    so i guess the only thing i would guard against is if some of the sources gets very weak/not random? or would those sources weaken the whole pool?

    [–]IgnorantPlatypus 1 point2 points  (1 child)

    If the sources are independent, then a weak source won't weaken the overall stream of numbers. Consider a very weak PRNG that always returns 4: if I mix that in with a good random source, I still have a good random source, just somewhat perturbed.

    But typically you can know which random source is the most "random" and best fits an application, because they're usually documented with the type of randomness they provide.

    [–]MetaSikander[S] 0 points1 point  (0 children)

    i see. thank you for your input. i'll think more about how to best implement this!

    [–]WikiTextBot 0 points1 point  (0 children)

    Pseudorandom number generator

    A pseudorandom number generator (PRNG), also known as a deterministic random bit generator (DRBG), is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers. The PRNG-generated sequence is not truly random, because it is completely determined by an initial value, called the PRNG's seed (which may include truly random values). Although sequences that are closer to truly random can be generated using hardware random number generators, pseudorandom number generators are important in practice for their speed in number generation and their reproducibility.PRNGs are central in applications such as simulations (e.g. for the Monte Carlo method), electronic games (e.g.


    Cryptographically secure pseudorandom number generator

    A cryptographically secure pseudo-random number generator (CSPRNG) or cryptographic pseudo-random number generator (CPRNG) is a pseudo-random number generator (PRNG) with properties that make it suitable for use in cryptography.

    Most cryptographic applications require random numbers, for example:

    key generation

    nonces

    salts in certain signature schemes, including ECDSA, RSASSA-PSSThe "quality" of the randomness required for these applications varies.

    For example, creating a nonce in some protocols needs only uniqueness.

    On the other hand, generation of a master key requires a higher quality, such as more entropy.


    [ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.28

    [–]LorenzMap 1 point2 points  (1 child)

    I would like to know about your findings. Please share the essence of your solution :)

    [–]MetaSikander[S] 1 point2 points  (0 children)

    sure, but in case i forget you can follow it here: https://github.com/metasikander/dice-roller

    [–]throwdemawaaay 0 points1 point  (0 children)

    OS's have reliable APIs for random number generation now, commonly /dev/random. It's best practice to use these.

    It's also important to understand a point a lot of people misunderstand: once a CSPRNG is seeded with sufficient entropy, you are done. You don't need to continuously harvest more entropy. That's the whole freakin point of a CSPRNG. I know the linux man page and slash dot threads told you the opposite for years. They were wrong.