Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <ctime>
- #include <conio.h>
- using namespace std;
- void shuffleArr(int *arr, int size)
- {
- int buf;
- int first, second;
- for (int i = 0; i < rand() % 50 + 10; i++)
- {
- first = rand() % size;
- second = rand() % size;
- int buf = arr[first];
- arr[first] = arr[second];
- arr[second] = buf;
- }
- }
- int main()
- {
- srand(time(NULL));
- int arr[15];
- for(int i = 0; i < 15; i++)
- arr[i] = i;
- shuffleArr(arr, 15);
- for(int i = 0; i < 15; i++)
- cout << arr[i] << endl;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment