Skip to content

Instantly share code, notes, and snippets.

@buraksarica
Created April 2, 2011 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buraksarica/899890 to your computer and use it in GitHub Desktop.
Save buraksarica/899890 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace YGSSifreIhtimal
{
class Program
{
const int soruSayisi = 45;
const int secenekSayisi = 5;
static int runcount = 0;
static int maxtutan = 0;
static void Main(string[] args)
{
bool devam = true;
List<int> tutmaHistogram = new List<int>();
for (int i = 0; i < soruSayisi + 1; i++)
{
tutmaHistogram.Add(0);
}
while (devam)
{
runcount++;
int tutan = 0;
Random rnd = new Random();
for (int j = 0; j < soruSayisi; j++)
{
List<int> soru = new List<int>();
for (int i = 0; i < secenekSayisi; i++)
{
soru.Add(rnd.Next(5000));
}
int cevap = rnd.Next(4);
int eskiCevap = soru[cevap];
soru.Sort();
cevap = rnd.Next(4);
int yeniCevap = soru[cevap];
if (eskiCevap == yeniCevap)
{
tutan++;
}
}
if (tutan > maxtutan)
{
maxtutan = tutan;
}
tutmaHistogram[tutan]++;
if (runcount % 1000 == 0)
{
Console.Clear();
for (int i = 0; i < soruSayisi; i++)
{
if (tutmaHistogram[i] != 0)
{
Console.WriteLine("{0} soru için şifreye uyan test sayısı -> {1}", i, tutmaHistogram[i]);
}
}
Console.WriteLine("toplam {0} adet test oluşturuldu",runcount);
Console.WriteLine("en fazla {0} soru için şifre gerçekleşti",maxtutan);
}
if (runcount == 1000000)
{
Console.ReadKey();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment