Bitcoin Forum
November 11, 2024, 05:50:57 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: 50%-50% probablity calculation  (Read 508 times)
davidshrugged (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
February 23, 2013, 04:28:12 AM
 #1

My first post  Grin!!!!

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?
zildjohn01
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
February 23, 2013, 06:17:51 AM
 #2

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!