Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _4._6
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] mas = new int[] { 1, 2, 3, 4, 5, 6, 7 };
- a(ref mas);
- }
- static int a(ref int[] b)
- {
- bool vhod = true;
- int[] count = new int[b.Length];
- int[] rememeber = new int[b.Length];
- for (int i = 0; i < b.Length; i++)
- {
- rememeber[i] = b[i];
- }
- Random random = new Random();
- int r1 = random.Next(1, b.Length);
- for (int i = 0; i < b.Length; i++)
- {
- for (int l = 0; l < i; l++)
- {
- vhod = true;
- if (count[l] == r1)
- {
- i -= 1;
- vhod = false;
- continue;
- }
- }
- if (vhod == true)
- {
- b[i] = rememeber[r1];
- count[i] = r1;
- }
- }
- for (int i = 0; i < b.Length; i++)
- {
- Console.WriteLine(b[i]);
- }
- return b[1];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement