HelixStar
HelixStar
CC#
Created by everestsh on 1/17/2023 in #help
❔ Random Letter
This code might fix it
12 replies
CC#
Created by everestsh on 1/17/2023 in #help
❔ Random Letter
Here is some sample code
using System;
using System.IO;

class GFG{

public static void Main(string[] args)
{
Random res = new Random();

String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

String FileText = "";
String randomstring = "";
for (int i = 0; i < 1000; i++){
for (int a = 0; a < 7; a++)
{

int x = res.Next(str.Length);
randomstring = randomstring + str[x];
}
FileText = FileText + $"{randomstring}\n";
Console.WriteLine("Random alphanumeric String:" + randomstring);
}

string file = @"codes.txt";
File.WriteAllText(file, FileText );

}
}
using System;
using System.IO;

class GFG{

public static void Main(string[] args)
{
Random res = new Random();

String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

String FileText = "";
String randomstring = "";
for (int i = 0; i < 1000; i++){
for (int a = 0; a < 7; a++)
{

int x = res.Next(str.Length);
randomstring = randomstring + str[x];
}
FileText = FileText + $"{randomstring}\n";
Console.WriteLine("Random alphanumeric String:" + randomstring);
}

string file = @"codes.txt";
File.WriteAllText(file, FileText );

}
}
12 replies
CC#
Created by everestsh on 1/17/2023 in #help
❔ Random Letter
Your writing to the file each time you create a new string.
12 replies