Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp3
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- int[] massive = new int[10];
- drawMassive(massive);
- Shuffle(massive);
- Console.ReadKey();
- }
- public static void drawMassive(int[] massive)
- {
- Random rand = new Random();
- for (int i = 0; i < massive.Length; i++)
- {
- massive[i] = rand.Next(10, 100);
- Console.Write(massive[i] + " ");
- }
- Console.WriteLine();
- }
- public static void Shuffle(int[] massive)
- {
- Random rand = new Random();
- for (int i = massive.Length - 1; i >= 0; i--)
- {
- int j = rand.Next(i + 1);
- int tmp = massive[j];
- massive[j] = massive[i];
- massive[i] = tmp;
- Console.Write(massive[i] + " ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement