Here's an interesting little scenario. You get challenged to a game of coin toss. Both players pick a sequence of coin toss results (heads or tails). The coin is repeatedly tossed until the sequence for one of the players occurs. The loser pays the winner a dollar. You'd assume that you each have an equal chance of winning. However, using two little "tricks" you can tip the odds in your favour. The first trick is to always choose second. If you can manage this then your strategy is as follows: Your first choice should be the opposite of your opponent's …

Member Avatar
Member Avatar
+0 forum 36

Here is a code snippet that calculates the probability of the outcome of a two sided game based on the capability of each side. I used it in my football league simulator program Could be used in any number of simulators which involve two parties. For equally strong parties, the result is calculated based on equal probability of all three outcomes. It can be written in hundreds of different ways. Good Luck

Member Avatar
+0 forum 0

hey i'm trying to generate numbers from 1 to 3 in a way such that number 1 has the probability 70% being generated number 2 has the probability of 20% of being generated number 3 has the probability of 10% of being generated how do i do that?? can anyone please help. Random r=new Random(); int i=1+r.nextInt(3); this doesn't take into account the probabilities and generates the numbers in a random way..i need to generate the numbers according to their probabilites of being generated

Member Avatar
Member Avatar
+0 forum 5

I have NO IDEA how to use Python. Best answer if you write the full program! Please help me! I will be forever grateful! Accept / Reject Monte Carlo Part I: Goal: Write a python program that will: 1. define a function for a specific probability density function f(x), 2. define a function that will sample from f(x) using the accept/reject Monte Carlo algorithm, 3. make a histogram of the samples and compare to f(x). Recall the accept / reject algorithm is: I. generate a uniformly random value of x (in its range) II. generate a uniformly random value y …

Member Avatar
Member Avatar
-2 forum 1

Hi I was doing an exercise in the Real Python book. It gave a task of simulating a coin toss "I keep flipping a fair coin until I've seen it land on both heads and tails at least once each – in other words, after I flip the coin the first time, I continue to flip it until I get a different result. On average, how many times will I have to flip the coin total? " So created the code: from __future__ import division from random import randint flips = 0 trials = 10000 for trial in range(0, trials): …

Member Avatar
Member Avatar
+0 forum 2

Basically I have found myself stuck in a math problem, any possibilities for assistance? I know this is java but I figured there must be a java programmer out there that knows how to solve this? c=95% In small NY towns (population < 30000) a sample of 22 libraries had 12600 books on average, with a standard deviation of 680. What can you say about the mean and the standard deviation of small town libraries generally? Please show me how to solve this?

Member Avatar
Member Avatar
+0 forum 4

Hey, I have two probability table for a variable say A ======================= B----------------- P(A) value1--------------.25 value2--------------.75 ======================= C-------------------P(A) value1--------------.55 value2---------------.45 ======================== How do i find probability for P(A/B=value1, C=value2) ?? Should I use Bayes theorem. If so how?

Member Avatar
+0 forum 0

Here is function to count the number of elementary events for sum of multiple throws of n-faced dice.

Member Avatar
Member Avatar
+1 forum 6

The End.