Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program {
- private static byte[] Magiya(int chislo) {
- Debug.Assert(chislo >= 0, "Eeee, blyat!");
- if(chislo == 0) {
- return new byte[] {0x30};
- }
- var i = (int) Math.Ceiling(Math.Log10(chislo + 1));
- var otvet = new byte[i];
- while(chislo != 0) {
- i -= 1;
- otvet[i] = (byte)(0x30 + chislo % 10);
- chislo /= 10;
- }
- return otvet;
- }
- static void Main(string[] args) {
- using(var fs = new FileStream("text.txt", FileMode.Create, FileAccess.Write))
- using(var bw = new BinaryWriter(fs)) {
- Random rnd = new Random();
- for(uint i = 0; i < 10000; i++) {
- bw.Write(Magiya(rnd.Next(0, 10000)));
- bw.Write((byte) 0x20);
- }
- }
- System.Diagnostics.Process.Start("text.txt");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement