Advertisement
EddyCZ

SomeCode

Oct 13th, 2018
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace SomeCode
  5. {
  6.     class Program
  7.     {
  8.         static Thread Thread01 = new Thread(Generate);
  9.  
  10.         static void Main(string[] args)
  11.         {
  12.             string Title = "Eddy^CZ 2018";
  13.             string Welcome = "Welcome in my random generator";
  14.  
  15.             Console.Title = Title;
  16.             Console.ForegroundColor = ConsoleColor.Cyan;
  17.             Console.WriteLine(Welcome);
  18.  
  19.             Thread01.IsBackground = true;
  20.             Thread01.Start();
  21.             Console.ReadKey();
  22.         }
  23.  
  24.         static void Generate()
  25.         {
  26.             var Random = new Random();
  27.             int Lenght = (int)byte.MaxValue;
  28.  
  29.             for (int i = 0; i < Lenght; i++)
  30.             {
  31.                 Thread.Sleep(1000);
  32.                 var Buffer = new byte[sizeof(UInt64)];
  33.                 Random.NextBytes(Buffer);
  34.                 var Number = BitConverter.ToUInt64(Buffer, 0);
  35.                 Console.WriteLine(Number);
  36.             }
  37.             Console.WriteLine("Thread is ended!");
  38.             Thread01.Abort();
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement