Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 09 August 2001  06:50 PM
Posted 09 August 2001  08:50 PM
Posted 10 August 2001  03:34 AM
Posted 10 August 2001  09:23 AM
quote:
Original post by Kylotan
Imagine you are about to flip a coin 10 times. You expect 5 heads. So you flip it coin 9 times, and get 5 heads and 4 tails. Given a proper coin, the 10th flip has a 50% (p = 0.5) chance of being heads. This means that, once you''ve had 9 flips, you have a 50% chance of scoring 6 heads. However at the start, it was a 50% chance of scoring 5.
quote:
I have seen the term ''stochastic'' used in some contexts similar to this, but have yet to find an explanation of the term that is both precise and yet not overly complex. Perhaps this is the solution to my problem, but I don''t know.
quote:
(For those who are interested, basically I just want this so that I can have a random number system in a game that allows for freak events, but takes corrective action to reduce the chance of an unlucky streak damaging a player''s chances.)
Posted 10 August 2001  09:26 AM
Posted 10 August 2001  09:35 AM
quote:
Original post by Grudzio
A small correction. Probability that in 10 flips you get 5 heads
is not 0.5 but smaller. To solve such problems (k succeses in N trials) you must use Bernoulli schema:
P(N,k)= N!/(k!*(Nk)!)*p^{k}*(1p)^{Nk}
N  number of trials, k  number of succeses
p  probability of success, P(N,k)  probability that in
N trials you have k succeses.
So P(10,5) = (10!/5!*5!)*1/1024 = 252/1024
quote:
The only meaning of "stochastic" I know about are stochastic processes. In such case stochastic means random as opposite to deterministic. I dont think they can help you,but I can be wrong.
Posted 10 August 2001  06:24 PM
Posted 10 August 2001  10:17 PM
Posted 13 August 2001  03:30 AM
Posted 13 August 2001  03:30 AM
Posted 13 August 2001  08:00 AM
Posted 13 August 2001  08:04 AM
Posted 13 August 2001  10:07 AM
Posted 17 August 2001  09:50 AM

Posted 17 August 2001  09:54 AM
Posted 17 August 2001  11:11 AM
Posted 18 August 2001  07:58 PM
Posted 19 August 2001  09:26 AM
Posted 19 August 2001  11:06 AM
int NewRand(int pctg)
{
static int trues = 0; //total #trues
static int totalcalls = 0; // total # function calls
int newChance; // adjusted value of percent chance
int result;
// adjust the percentage to compensate for the difference
// between actual and desired. As the difference approaches
// the order of the percentage itself, the system approaches
// 0% chance of returning a true.
// Might as well increase the # fnc calls here, as well
newChance = pctg  ((int)((float)trues/(float)(++totalcalls))  pctg))
// constrain the chance to 0 thru 100, obviously
if (newChance < 0) newChance = 0;
else if (newChance > 100) newChance = 100;
// GenRand is a generic PNRG on a percentage system
result = GenRand(newChance);
// If we got a true record it
if (result) ++trues;
return result;
}
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.