I'd like to use the list initialized with random numbers in Unity c#, but the current method will result in a long code as follows.
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();
© 2025 OneMinuteCode. All rights reserved.