Questions tagged [coin-flipping]

Coin flipping is the process of programmatically simulating a coin flip, that is randomly picking a choice among two possibilities.

Coin flipping is the process of programmatically simulating a coin flip, that is randomly picking a choice among two possibilities.

118 questions
0
votes
1 answer

Simulating Coin Tossing To Obtain 2 Heads Before 3 Tails (Java)

(Note: There are some similar problems, but I could not find an exact duplicate) Question Consider flipping a coin an arbitrary number of times. What is the probability that you obtain 2 heads before 3 tails? Code To simulate this, I set up…
0
votes
3 answers

consecutive coin flip

I apologize in advance for my lack of Java knowledge. I am new to Java programming and am trying to make a program where I can flip a coin and count how many times the coin lands on heads within N amount of rolls, measure the time it takes to do so,…
Bfrank
  • 33
  • 1
  • 3
  • 11
0
votes
2 answers

Getting errors for unknown reason

Trying to design a coin flipper program that asks the user to state how many times they would like to flip a coin (# of flips must be under 1000). I then get a random number from 1-10 and assign that number to each array index declared based on the…
Zack
  • 591
  • 1
  • 9
  • 22
0
votes
5 answers

coin flip simulate in python

I want to simulate flipping a fair coin 500 times. Then I have to create a graph to show the running proportion of heads when flipping a coin with flip number on the x-axis and proportion heads on the y-axis. I wrote the Python code and I got the…
Alloho
  • 11
  • 1
  • 3
0
votes
2 answers

Modified coin flip program in Python, can't work out the loop

So I'm required to write a lab for my Python class to flip a coin. Yes, it's been asked before, but this one in particular, I haven't seen any examples in any of the searches I've done. The program is supposed to accept input from the user, how many…
b0dhi_
  • 15
  • 5
0
votes
1 answer

Coin Flip Grouping Results (C#)

I was having trouble with an assignment I have, where after displaying results of a coin flip program, where it would typically look like: (This is for C# by the way) Heads Tails Tails Tails etc. I now have to group them in rows. For example, if…
jgudani
  • 11
  • 3
0
votes
3 answers

Simulate the tossing of a coin three times and print out the percentage of cases in which one gets three tails

Attached is the problem: http://puu.sh/42QtI/ea955e5bef.png In terms of code, this is what I have so far The question asks to "calculate the simulated percentage of three tails," which is the part I am stuck on. Could someone give me some insight on…
theGreenCabbage
  • 4,737
  • 14
  • 60
  • 151
0
votes
3 answers

Coin Toss program not working Visual Studio 2010

A book exercise prompts me to create a program that simulates coin tossing. My friend says he ran my code in a native GNU compiler, and it worked, but I'm receiving the following errors when I try to run it in Visual Studio 2010: #include…
0
votes
5 answers

Starting out in Python Development: Coin-Tossing Loops

Afternoon all, I cross your paths as someone looking to teachimself programming. As such, I've started with Python. As a disclaimer, I have searched the question for some examples of Python coin-tosses but I've not really understood any of the…
0
votes
2 answers

Slowing down looping animation as3

This is the first time I've ever posted in a forum, so thanks in advance for anyone who takes the time to read/answer this question. What I'm trying to create is basically a flipping coin animation, which starts off turning very fast and then slows…
-1
votes
3 answers

C# - Keeping total number of correct guesses inside a variable

Beginner to programming & have been assigned a heads or tails coin flip project. I've figured out how to make it randomly generate the number of requested flips and print out the answers. However, I'm supposed to have it add up how many times the…
Brooke
  • 3
  • 1
-1
votes
1 answer

Python: Can a coin flip generator be modified to printout certain combinations?

Simply put, I would like to know if there is a way to print out coin flip combinations that only meet a certain criteria. In this case, only those with <=n consecutive H's or T's gets printed. For example, here's all possible combinations of 5 coin…
DanielHK
  • 3
  • 3
-1
votes
2 answers

Coin-flip command gives only 'tails' and 'you loose'

I tried to make a coin flip command where the user types .cf heads and the bot shows him his answer, the result and whether they won or lost. I tried using args and without it but it didn't work; there is an error in my code: bot.on('message',…
-1
votes
1 answer

Having issues with numbers being printed

I'm working on a coinflip game which adds your inputed value to your balance Snippets of code from earlier: deposit = input("Enter how much to deposit") money = file1.read() resultmonecoin = int(money)-int(deposit) Main code that test if you got…
T.ps
  • 41
  • 1
  • 10
-1
votes
1 answer

solution for the flipping coin issue

I am trying to solve this prolem : a random experiment of tossing a coin 10000 times and determine the count of Heads:: defining a binomial distribution with n = 1 and p = 0.5. using binom function from scipy.stats setting random seed to 1 Draw a…
RubenSo
  • 13
  • 5