# How to design a digital coin flip mechanism? [closed]

I want to implement the coin flip mechanism in which the result will be independent of anything just like real coin flip.I am confused on how to make totally independent...

## closed as off-topic by Matthew, Purefan, RoraΖ, crovers, SteveFeb 3 '17 at 15:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question does not appear to be about Information security within the scope defined in the help center." – Matthew, Purefan, RoraΖ, crovers, Steve
If this question can be reworded to fit the rules in the help center, please edit the question.

• A coin flip is not "independent of anything". A coin flip's results depends on a discrete factors (where on the coin you strike, amount of force, angle of your finger when you strike, stiffness of your fingernail, movement of the hand-coin system, "thickness" and movement of air, height of landing surface, and nature of landing surface). If you control those factors, you can produce the same result every time. The same thing with computer PRNGs. – Adi Feb 3 '17 at 13:09

Depending on what language you are using, some of them can generate cryptographically secure pseudo-random integers, which is probably good enough for a coin flip mechanism, such as PHP 7's random_int function.

However, there are also true random number generation services out there, such as api.random.org. The randomness comes from atmospheric noise, rather than a pseudo-random algorithm.

You can't. That's why methods for what you really want are called CSPRNGs - Cryptographically Secure Pseudo Random Number Generators.

Yet, what is true for most of crypto is true here, too: If you don't know what you're talking about, try not to implement it yourself. Instead, use established libraries that offer what you need.

Of course you can. The coin is still dependent on it's physical state and velocity, but it is not discretely predictable.

https://www.random.org/coins/ has a random number generator based on atmospheric noise. That's a lot more random than a dice or a coin. it's quantum.

If you don't want an online service you can buy a hardware TRNG USB dongle or get the noise from a cheap RTL-SDR.

But the difference are mostly theoretical. For what you want, a CSPRNG will suffice. /dev/urandom will do on unix (and no, it's not inferor to /dev/random).