daily update on 20240514 by nitload youmu

This commit is contained in:
YoumuLiu
2024-05-14 15:41:22 +08:00
parent a3506c96a3
commit 2e57126ab7
75 changed files with 3572 additions and 198 deletions
+62
View File
@@ -0,0 +1,62 @@
using Randomizer;
using System.Text;
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
string test =DateTime.UtcNow.ToString("o");
RandomGenerator r = new RandomGenerator(test);
Random rd = new Random(test.GetHashCode());
string filename = "rand.bin";
/*
if (!File.Exists(filename))
{
FileStream stream = File.Create(filename);
stream.Close();
}
using (FileStream fileStream = File.Open(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
// 清空文件内容
fileStream.SetLength(0);
for (int i = 0; i < 1e5; i++)
{
int num = r.GenRandomInt();
byte[] stream = BitConverter.GetBytes(num);
fileStream.Write(stream,0,4);
}
}
/**/
/**/
int groupCount = 200, groupCapacity = 100;
int[] count = new int[groupCount];
int[] count1 = new int[groupCount];
Array.Fill(count, 0);
Array.Fill(count1, 0);
for (int i = 0; i < groupCount * groupCapacity; i++)
{
float num = r.GenRandomSingle();
int index = (int)(num * groupCount);
//Console.WriteLine(num);
count[index]++;
}
for (int i = 0; i < groupCount * groupCapacity; i++)
{
float num = rd.NextSingle();
int index = (int)(num * groupCount);
//Console.WriteLine(num);
count1[index]++;
}
for (int i = 0; i < groupCapacity; i++)
{
Console.WriteLine($"{count[i]}\t{count1[i]}\t{groupCapacity}");
}
/**/
}
}
}