Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Task32
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
- DrawArray(array);
- Console.WriteLine();
- Shuffle(array);
- DrawArray(array);
- }
- static void Shuffle(int[] array)
- {
- Random random = new Random();
- for (int i = array.Length - 1; i >= 1; i--)
- {
- int randomIndex = random.Next(i + 1);
- int tempValue = array[j];
- array[j] = array[i];
- array[i] = tempValue;
- }
- }
- static void DrawArray(int[] array)
- {
- for (int i = 0; i < array.Length; i++)
- {
- Console.Write(array[i] + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement