I'd like to use a list initialized with random numbers in unity c#, but with this method, the code will be this long.
For me, who has become python, it's very troublesome to write like this every time
Is there any way to make a list of random numbers cleaner, preferably one line?
List<int>outputs=new List<int>();
foreach(intz_inEnumerable.Range(0,output))
{
outputs.Add(Random.Range(0,wall_len));
}
Enumerable.Range(0,output).Select(_=>Random.Range(0,wall_len))).ToList();
© 2024 OneMinuteCode. All rights reserved.