C# 8.0:
using System;
...
var Arr = RandomIntArr(0,10,8);
foreach(int i in Arr) Console.Write(i+" ");
Console.WriteLine();
foreach(int i in Arr) Console.Write(i*i + " ");
static int[] RandomIntArr(int Min, int Max, int ArrLen) {
Random rnd = new Random();
int[] Out = new int[ArrLen];
for (int i = 0; i < ArrLen; i++) Out[i] = rnd.Next(Min, Max+1);
return Out;
}
C# 8.0:
using System;
...
var Arr = RandomIntArr(0,10,8);
foreach(int i in Arr) Console.Write(i+" ");
Console.WriteLine();
foreach(int i in Arr) Console.Write(i*i + " ");
...
static int[] RandomIntArr(int Min, int Max, int ArrLen) {
Random rnd = new Random();
int[] Out = new int[ArrLen];
for (int i = 0; i < ArrLen; i++) Out[i] = rnd.Next(Min, Max+1);
return Out;
}