flat assembler
Message board for the users of flat assembler.

 Index > Heap > coin toss game - how to toss coins on bets Goto page Previous  1, 2
Author
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17279
revolution
If you think of each toss as either 0 or 1, and consider 8 tosses instead of 10. Then each possible sequence of tosses gives one byte of output somewhere in the range [0,255].

You are treating 8 one's (0xff) as something special, but it is not. Any value has the same probability of occurring. 8 one's (0xff) has the same chance as 0x2b, or 0xe0 etc. All values have a chance of 1 on 2^8.
12 Apr 2014, 21:43
sleepsleep

Joined: 05 Oct 2006
Posts: 8903
Location: ˛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
each toss as either 0 or 1, with 50/50 on each toss.

8 continuous toss with all 0 or all 1 is really special.
because you can't get this result easily.

the most common result are, 0 then 1, or 1, then 0, or a few 1 then 0, or a few 0, then 1

the a few here, i say, less than 5 times.

in fact, if i get a coin now, toss it 8 times, or maybe toss it for my whole life,

a continuous 10 toss or 8 toss with head/ or tail, might be near impossible.
12 Apr 2014, 22:53
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17279
revolution
sleepsleep wrote:
8 continuous toss with all 0 or all 1 is really special.
No, it is not special. It is you that is treating it as special. It has the same specialness as 0x47. And 0xa9.

How likely is it that your 8 tosses will give 0x7c? Answer: The same as getting 0xff, or 0x00.
12 Apr 2014, 22:56
baldr

Joined: 19 Mar 2008
Posts: 1651
baldr
Each 8-sequence of 0s and 1s is equiprobable; we're talking about probability of equivalence classes, i.e. classes of 8-sequences with 0, 1,…, 8 1s. Let's see:

There is only one 8-sequence with no 1s: 00000000; eight 8-sequences with only one 1; as the whole picture goes:
Code:
```0:  1   *
1:  8   ********
2: 28   ****************************
3: 56   ********************************************************
4: 70   **********************************************************************
5: 56   ********************************************************
6: 28   ****************************
7:  8   ********
8:  1   *    ```
(yes, those ubiquitous binomial coefficients). Given a fair coin, the probabilities are easy to calculate; you may check whether your coin is fair with any (reasonable) level of confidence using the math behind the Bernoulli process; even if that coin is unfair, you may simulate fair coin with it via von Neumann randomness extractor.
13 Apr 2014, 04:43
tthsqe

Joined: 20 May 2009
Posts: 724
tthsqe
baldr&revolution, thanks for bringing some sanity back to this thread. I was starting to get depressed about education standards...what kind of experiments did you try in grade school?
While we are on the topic of probability, does anyone have an answer to my challenge at http://board.flatassembler.net/topic.php?t=15780&postdays=0&postorder=asc&start=20?
13 Apr 2014, 05:12
Dr F

Joined: 01 Apr 2014
Posts: 239
Location: Berehove, Ukraine
Dr F
welll at first it doesnt quite work got about equal not going too far.. 40-50 throws.. basicly.. some of my brainparts can tap into things.. so if i concentrate well and i cann see at least subconsciously the head or tail.. as spinning in air, i flip it up.. then concentrate on the thing.. and it lands.. first i got equial about that.. then i made for quite some time double tails so there was more chance.. then i started making heads deliberately so i made a lot of heads and i wanted it so.. i vsn drr zhr coin.. my subconscious can know arrangement of coin.. so if i concentrate it will more often catch as i need it..

Pretty cool topic. its not so much about logic i think rather it is about throwing skills.

_________________
Best location where I Harden, shall be the most beautifull Garden
13 Apr 2014, 16:58
sleepsleep

Joined: 05 Oct 2006
Posts: 8903
Location: ˛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
if it is 50/50,
what is the chances of getting 20 people,
to let everybody toss same head/tail at the same time? 50/50 ?
14 Apr 2014, 13:47
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17279
revolution
1 in 2^20.
14 Apr 2014, 13:58
sleepsleep

Joined: 05 Oct 2006
Posts: 8903
Location: ˛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
actually, i am kinda wonder, what percentage of confirmation is that 1 in 2^20?
or, it is a confirm fact? because, i seriously don't think so.

another view of this is,

if let say a random number generator for 1 to 10,000, and we put a counter for each displayed number.

let say, you call it for 10,000 x 10 times, would there be a number still with 0 displayed count?
15 Apr 2014, 19:27
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17279
revolution
sleepsleep: Perhaps you should read a book about statistics instead of expecting us to teach you here. This is basic stuff that is explained in all the introductory texts.
15 Apr 2014, 19:47
edfed

Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
15 Apr 2014, 19:51
sleepsleep

Joined: 05 Oct 2006
Posts: 8903
Location: ˛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
ok, sorry with my lack of knowledge with statistic,

a few questions,
1. if after a 15,000 times random procedure was called, and i noted there is a number is still not yet displayed, does it still 50/50 for the next call?

2. so, is there a statistical result different this random number generator with tossing coin?
16 Apr 2014, 04:25
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17279
revolution
sleepsleep wrote:
a few questions,
More? Have you been down to your local library yet to get some stats books?
sleepsleep wrote:

1. if after a 15,000 times random procedure was called, and i noted there is a number is still not yet displayed, does it still 50/50 for the next call?
Now you are into the situation where you suspect the coin/die/RNG/PRNG/whatever is not perfectly fair.
sleepsleep wrote:
2. so, is there a statistical result different this random number generator with tossing coin?
This is also covered by stats books. Read about confidence levels, hypothesis testing and sigma values. Usually something like 2-sigma or 3-sigma is used to determine if some hypothesis is true or false within the specified confidence level. A regulated casino might have a higher requirement of 5 or 6 sigma for the (P)RNGs to comply within regulations.
16 Apr 2014, 04:35
sleepsleep

Joined: 05 Oct 2006
Posts: 8903
Location: ˛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
sorry ...much effort is required in my part to understand this.

revolution wrote:

Now you are into the situation where you suspect the coin/die/RNG/PRNG/whatever is not perfectly fair.

yeah, because of the idea, eventually, with some level of certainty, this number will get called.
because of another idea, could 10,000 x 10 times and we have a number without being called.

regarding the 2nd question,
is random a mimic of how nature works? must have a graph of some sort of distribution?
or random should be, random, unknown, unpredictable?
16 Apr 2014, 11:07
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17279
revolution
sleepsleep wrote:
sorry ...much effort is required in my part to understand this.
If you can't be bothered to learn then I perhaps I shouldn't be bothered to try and answer you?
sleepsleep wrote:
is random a mimic of how nature works?
Do you know about quantum mechanics? The Heisenberg uncertainty principle?
sleepsleep wrote:
must have a graph of some sort of distribution?
Maybe. Not all distributions are the same.
sleepsleep wrote:
or random should be, random, unknown, unpredictable?
Read about chaos theory. Collectively randomness can be predicable and is well defined. Individually each sample can't be known ahead of time.
16 Apr 2014, 11:23
sleepsleep

Joined: 05 Oct 2006
Posts: 8903
Location: ˛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
revolution wrote:

If you can't be bothered to learn then I perhaps I shouldn't be bothered to try and answer you?

sorry, my poor english maybe cause some misunderstanding here.
what i mean is,
i apologize, then i said, i will need to put more effort (which is required to be performed by me [my part]) in order to understand this topic.
16 Apr 2014, 14:12

Joined: 25 Nov 2013
Posts: 216
Location: %x
for this calculate we need the fpu inside our computer
24 Apr 2014, 06:38
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials Other----------------FeedbackHeapTest Area
Goto page Previous  1, 2

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou can attach files in this forumYou can download files in this forum