Modification of the structure of the mass by means of lymbda



  • The target for the mass is to form the expression strap. Elements of the mass are available with Random. Dun is a size mass of N. Change the order of his elements to the reverse.



  • For the moment, I see the decision as follows:

    void Main()
    {
        Random rand = new Random();
        var a = Enumerable.Range(1,10).Select(el=>rand.Next(1,10)).Reverse();
        //[6,6,2,2,9,3,4,1,5,7] примерно так
    }
    
    • Enumerable.Range(1,10) - creates a set of ten numbers from one.
    • Select(el=>rand.Next(1,10)) - creates early numbers and chooses them.
    • Reverse() - changes their order to reverse.

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2