| SexScripts : Distribution functions for occurrences of specific events - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=759 | Page 1 of 1 |
Distribution functions for occurrences of specific events |
vladl [ Wed Apr 18, 2018 12:20 pm ] |
|---|---|
For example when playing a game with condition that one gets to cum after a maximum of x days. On possibility to solve this is to get x random numbers [0,1,..,x-1] and if it is 0 one gets to cum on the first day, it is 1 one gets to cum on the second day and so on. Per day there is a 1/x*100 % chance to cum with an mathematical expectation of (x+1)/2. When one gets to cum after a maximum of 10 days there would be a cum chance of 10% per day-1 with a mathematical expectation of 5,5. But this is pretty boring and not very realistic. I think it would be more convincing when the chances get higher every day. For example for a maximum of 5 days it could look like this: chances=[5,10,15,30,40] (Index of chances[] represents the day-1 and the value represents the chance of cumming on that day in %. Sum of chances[] should be 100) Furthermore I could imagine that is even more interesting if the user could not just be able to configure the maximum of days but also the expected value (EV)/ mathematical expectation at what day are the highest chance, and the chance gets more and more lower the more the actual value gets away from the EV (I hope you can understand what I mean, if not please ask) Here is an example what I mean with that, max days= 5, EV = 3: chances=[10,20,40,20,10] This means it is most likely that on gets to cum on the 3. day (user defined EV=3): 40%. Less likely on the 2. and 4 day: 20% (EV +/- 1) and least likely on day 1 and 5: 10% (EV +/- 2) Any suggestions or opinions and how to generate such probabilities lists automatically? |
|
Re: Distribution functions for occurrences of specific event |
cgut2001 [ Wed Apr 25, 2018 10:41 pm ] |
|---|---|
Hi vladl, as a general approach I'd suggest you use one of the "well known" distribution-functions, generate a random value between zero and one and find the point, where the cumulative distribution function is above your random value. There are several discrete distribution functions which could be used for this. The binomial distribution may be what you want or at least it could be a good starting point as it has two parameters that let you tune the center and width easily. The poisson distribution may be another candidate. It has only one parameter but the cdf is quite easy to calculate. There are library-functions available in the math3-Package. Unfortunately this is not included with sexscripts. Implementing distribution functions yourself will be quite cumbersome in most cases. Because of that it may be better to locate a table in the internet and copy it to a data-stucture. An alternative may be to feed one of the online-calculators available at a lot of maths/physics websites and use its result. Alternatively you could ask doti to include the parts of math3 needed with sexscripts. |
|
Re: Distribution functions for occurrences of specific event |
doti [ Thu Apr 26, 2018 9:32 am ] |
|---|---|
Well, the licence is compatible, but its 1.9Mb only for this (desktop and Android packages are currently only 9Mb), so I'm not very fond of the idea of including it as a standard package. Some other writers want it ? Edit: anyway, a one-liner, because groovy is easy : Code: def day = 2 //first is 0 def chances = [10,20,40,20,10] if(getRandom(chances.sum()) < chances[0,day].sum()) { show("Cum today") } |
|
Re: Distribution functions for occurrences of specific event |
cgut2001 [ Thu Apr 26, 2018 5:46 pm ] |
|---|---|
doti wrote: Well, the licence is compatible, but its 1.9Mb only for this (desktop and Android packages are currently only 9Mb), so I'm not very fond of the idea of including it as a standard package. True, this is too big. Especially as there won't be many other uses for this library in the context of sexscripts. |
|
| Page 1 of 1 | All times are UTC + 1 hour [ DST ] |