Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Recur6
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static readonly Random rand = new Random(); public static void Main(string[] args) { //Your code goes here //Recursive(4,.53); /* double a = 362.3; int b = (int) a/10%10; Console.WriteLine(b); Console.WriteLine(RandomDouble()); for (int i = 0; i<1400; i++) { //Console.Write("{0, 1}", rand.Next(0,10), RandomInt(0,10)); //Console.Write("{0} ", rand.Next(4,9)); //Console.WriteLine(rand.Next(1,366)); } */ for (int i = 0; i<1400; i++) { Console.WriteLine(RandomInt(1,366)); //Console.WriteLine(RandomDouble()); } /*double x=2; for (int i=0; i<100; i++){ x=x*1.2; Console.WriteLine(x); }*/ /*for (int i=0;i<500;i++) { List<double> list = new List<double>(); list.Add(ToTenth(RandomDouble())); //Console.WriteLine(ToTenth(RandomDouble())); foreach (var member in list){ Console.WriteLine(member); } } */ } /*public static double Recursive(double r, double x) { double x2=x; double x3; for (int i=0; i<rand.Next(150,200); i++) { x=x2; x2=r*x*(1-x); return x2; } return } public static double Recur( double r, double x) { }*/ /*public static long Geo(long x, int times){ int n=2; if (times<=1){ return x; } return Geo(x*n, times-1); }*/ public static double Geo(double x, int times){ double r=3.99999; if (times<=1){ return r*x*(1-x); } return Geo(r*x*(1-x), times-1); } public static double RandomDouble(){ int count = 20;//rand.Next(30,40); double x = rand.NextDouble(); while (true) { if (Geo(x,count)>0.001) { return Geo(x,count); //decimal number } } } public static int RandomInt(int lower, int upper){ return Convert.ToInt32(RandomDouble()*(upper-lower-1)+lower); } public static double ToTenth(double number) { if (number>0.5 || number<0.7){ return number; } else { string number_string = number.ToString(); //string number_string_new = number_string.Substring(0,number_string.IndexOf(",")+1)+number_string.Substring(number_string.IndexOf(",")+1).TrimStart('0'); string number_string_new = number_string.Substring(0,3)+number_string.Substring(4).TrimStart('0'); //Console.WriteLine(number); //Console.WriteLine(number_string_new); double number_new = Double.Parse(number_string_new); return number_new; } } } }
run
|
edit
|
history
|
help
0
Plt-D v.0.9.4
Symantic check for object type variables
Classes, properties, methods, ling begining
events
helloworld
line 1 syntax error
Pos and Neg
triangular matrix
test coeur
train 11111111