static void Main(string[] args) { RandomWordStream slowo = new RandomWordStream(); Console.WriteLine("Randomowe slowa"); Console.WriteLine(slowo.next()); Console.WriteLine(slowo.next()); Console.WriteLine(slowo.next()); Console.WriteLine(slowo.next()); PrimeStream prime = new PrimeStream(); Console.WriteLine("\n\nPrimeStream:"); Console.Write(prime.next() + " "); Console.Write(prime.next() + " "); Console.Write(prime.next() + " "); Console.Write(prime.next() + " \n\n"); IntStream integers = new IntStream(); Console.WriteLine("IntStream:"); for (int i = 0; i < 20; i++) { Console.Write(integers.next() + ", "); if (i == 3) { integers.reset(); } } }
public string next() { napis.Clear(); int length = prime.next(); int start = (int)'!'; int end = (int)'~' - start; for (int i = 0; i < length; i++) { char znak = (char)(random.next() % end + start); napis.Append(znak); } return(napis.ToString()); }
public string next() { string result = ""; int pierwsza = prime.next(); for (int i = 0; i < pierwsza; i++) { result += randchar(); } return(result); }