A ratio (or percentage) is a good way to think of it. How are you getting the results when it is 50/50?
[OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
The result was:
Number of Heads = 92
Number of Tails = 8
What do you see not working in yours?
[OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Glad to hear you got the solution , can you please post the solved code so It may also be helpful to others who perhaps have same problem.
Of course you can create a separate topic for your new problem, volunteers who knows the answer will definitely try to help you.
micah wise wrote:Ok so he isn't preferential of the boolean method
Who said this? What "boolean method"?
what other way is there to represent 50 : 50 or 60 : 40 or etc??? I am really lost
Me too! Could you post your code with a comment on the line(s) that are the problem?
All things are lawful, but not all things are profitable.
micah wise wrote:Ok so he isn't preferential of the boolean method what other way is there to represent 50 : 50 or 60 : 40 or etc??? I am really lost
Here's what I'm guessing you mean by this: he prefers you to use a different method other than (rand < skewPoint) where you change the value of skewPoint to skew the results.
If so, consider this:
Practice only makes habit, only perfect practice makes perfect.
Practice mindfully by doing the right things and doing things right.— Junilu
[How to Ask Questions] [How to Answer Questions]
@micah
an experiment that has two possible outcomes (success/failure, 1/0, true/false, et cetera) is called a Bernoulli trial. It is characterized by one number p with 0 <= p <=1, the chance of success. A straightforward way to model this is for instance:
But sometimes it is more convenient to return either a 1 or a 0, like in
and I suppose that this is what the prof meant.
With this latter definition your flip con program becomes as simple as
There is nothing to stop one from repeating many trials in succession. If we are interested in the total number of successes, then this total is according to the so called Binomial distribution. This is exactly what you do in your flip coin code . Applications are plenty:
If we have 1000 children, what is the chance that we have more than 550 girls
if we cast 100 dice, what is the chance that 30 of 'm have either 2 or 5 eyes
if we throw a coin 1000 times and we get 650 times a head, do we still believe that head has a 50% chance?
I read that your next assignment is about boys and girls. Let me finish with a small classic problem:
A family has two children. What is the chance that both of these are boys, if we know that
* the older child is a boy
* at least one of them is a boy?
Happy coding.
Beware the other head of science  it bites! Nibble on this message:
The WEB SERVICES and JAXRS Course
https://coderanch.com/t/690789/WEBSERVICESJAXRS
