You can use the following LINQ chain:
int[] array2 = new int[] { 1, 3, 5, 7, 9 };
var random = new Random();
var total = (int)array2.
OrderBy(digit => random.Next()).
Select((digit, index) => digit*Math.Pow(10, index)).
Sum();
First, it orders the elements randomly, then it selects each element multiplied by 10 raised to the power of its index, then sums them together and casts the result to an integer. Also, please note that I didn't provide an useful seed for your Random
instance. You might want to do that, to produce pseudo-random results.
You might also want to use a method for exponentiation described here, to avoid having to cast to an integer.
EDIT: As Rhumborl pointed out, you may just need the shuffled array. In that case:
var shuffledArray = array2.OrderBy(n => random.Next()).
ToArray();
Should work for you.