kawikaze
kawikaze
CC#
Created by kawikaze on 9/28/2022 in #help
I'm having problems with a range of numbers and random generator (im new)
I have an array of number (1-50, scaled), where one will be selected randomly and then every number on the right side of selected number will move one step to the left and then selected number will be removed and the variable in the last position (50) will turn into 0. But I have this part in my program that's having problems when moving the numbers (highlighted part). I dont know why that statement wont work: static void Main(string[] args) { do { Console.WriteLine("How many rows do you want?: "); int rows = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < rows; i++) {
} } while (Console.ReadKey().KeyChar == 'y'); } static void PasteRow(int[] rNum) { Random r = new Random(); rNum = new int[50]; for (int i = 0; i < 50; i++) { rNum[i] = i; } int select = r.Next(1, 51); Console.Write(rNum[select]); for (int i = 0; i < 50 - select; i++) { rNum[select] == select + 1; } } static bool HasDoublet(int[] array, int value) { for (int i = 0; i < array.Length; i++) { if (array[i] == value) { return true; } } return false; }
4 replies