![]() |
|
[C#] C# calculate drop rate of sandwhiches - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] C# calculate drop rate of sandwhiches (/showthread.php?tid=5922223) |
C# calculate drop rate of sandwhiches - Carlsson94 - Dec 24, 2018 I have a school assignment that I would like to get done, however, I have issues trying to reach my teacher during the holidays. I'm supposed to check if I drop 100 sandwiches how many of them will fall the right way up? I have a slider where I can change my % value, but I'm not sure how I would do the calculation. Id assume I would do this in a for loop I have a slider where I get the Fortune value called: FortuneValue ![]() PHP Code RE: C# calculate drop rate of sandwhiches - BahNahNah - Dec 24, 2018 Is the slider how much chance it will be the right way up? Code rightWay = ammountdropped * (percentChanceOfBeingRightWayUp / 100)and the wrong way is the rest. Basic math yo. RE: C# calculate drop rate of sandwhiches - Carlsson94 - Dec 24, 2018 (Dec 24, 2018 04:34 AM)BahNahNah Wrote: Is the slider how much chance it will be the right way up? Thats what I did before the holidays, how ever I failed. I was told "Note that probability is not the same as actual outcome". Meaning if I drop 100 sandwhiches and I have only have a 50% chance not everyone will land the right way up Because I did this Code int tries = Convert.ToInt32(Tries.Text);RE: C# calculate drop rate of sandwhiches - BahNahNah - Dec 24, 2018 (Dec 24, 2018 04:41 AM)Carlsson94 Wrote: Thats what I did before the holidays, how ever I failed. I was told "Note that probability is not the same as actual outcome". For each attempt, check the probability that it is the right way up. For example, 50/50 Code for(i = 0; i < numberofflips; i++){RE: C# calculate drop rate of sandwhiches - Carlsson94 - Dec 24, 2018 (Dec 24, 2018 05:41 AM)BahNahNah Wrote: For each attempt, check the probability that it is the right way up. For example, 50/50 Now I just have too implement my Fortune slider, but I think I'm on the right path, cheers! |