Bitcoin Forum

Other => Beginners & Help => Topic started by: davidshrugged on February 23, 2013, 04:28:12 AM



Title: 50%-50% probablity calculation
Post by: davidshrugged on February 23, 2013, 04:28:12 AM
My first post  ;D!!!!

We just released a flipping coin game for bitcoins [our twist: with chained flips] http://www.mangofuzz.com/ and we are using the following method to simulate the 50&-50% chance of tossing a coin.

In C++ we :
  • seed it with the current time stamp
  • get a number between 0 and 1 like this: rand()/((double)RAND_MAX + 1

If such number is less than 0.5, the user wins.

We will use R instead of C in the next incarnation.

Thoughts on this simple approach?


Title: Re: 50%-50% probablity calculation
Post by: zildjohn01 on February 23, 2013, 06:17:51 AM
The gold standard in Bitcoin is provably secure randomness, such as what SatoshiDice does. They generate a list of secret keys, one for each day, and publish the hashes ahead of time. They then use that secret to determine your random number, and they publish the plaintext secrets for previous days after the fact so that results can be verified.