Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Vajdalinky
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Calculate() { int lower = 0; int higher = 0; int lower2 = 0; int higher2= 0; int pokusu = 0; System.Random r = new System.Random(); double xmin = 10; double xmax = 1000; for (int i = 0; i < 10000000; i++) { double random = r.NextDouble(); //double y = (0.6888 * (random * random)) + (1.6624 * random); //double y = ( 0.6888 * (random * random)) + (0.2848 * random)+ 0.0048; //double y = ((0.2739*(random*random*random)) + (0.278 * (random * random)) + (0.4415 * random ));// - 0.0052; //double y = (-0.6888 * (random * random)) + (1.6624 * random); //double y = (1.1364*(random*random*random*random)) - (1.9988*(random*random*random)) + (1.6984*(random*random)) + (0.1574*random) + 0.003; double y = (0.2795*(random*random*random)) + (0.279*(random*random)) + (0.4415*random); int result = (int)Math.Round(xmin + ((xmax - xmin) * y)); pokusu++; //if ( result < xmin ) // result = (int)xmin; if ( result < xmin || result > xmax ) { Console.WriteLine( string.Format("Chyba, hodnota mimo: {0}", result) ); Console.WriteLine( string.Format("Random = {0}", random ) ); Console.WriteLine( string.Format("Y = {0}", y )); break; } if ( result == xmin ) lower2++; else if ( result == xmax ) higher2++; if (result < ((xmax + xmin) / 2)) lower++; else higher++; } Console.WriteLine(string.Format("Rozpětí: {0}-{1}", xmin, xmax) ); Console.WriteLine( string.Format("Pokusů: {0}", pokusu) ); Console.WriteLine(string.Format("nizsi polovina: {0}", lower)); Console.WriteLine(string.Format("vyssi polovina: {0}", higher)); Console.WriteLine(string.Format("min hodnota: {0}x", lower2)); Console.WriteLine(string.Format("max hodnota: {0}x", higher2)); } public static void Main(string[] args) { Calculate(); } } }
run
|
edit
|
history
|
help
0
UF pc
Chest Interaction Unity
How To Get Discord Nitro For Free
DateTime
Período
char.IsNumber
іфи
ByRef
Floating point arithmetics
Problem Name_single_digi