Moderator
M
Moderator
08:23, 17th Mar 2013
Magtheridon96: Refer to my post in the thread.
Also, this doesn't do 150000 shuffles :v
Magtheridon96: Refer to my post in the thread.
Also, this doesn't do 150000 shuffles :v
#include <iostream>
#include <time.h>
#include <random>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char* argv[]) {
string line;
ifstream input;
ofstream output;
if (1 == argc) { return 0; }
input.open(argv[1]);
if (input.is_open()) {
getline(input, line);
input.close();
if (line.length() > 0) {
int shuffles = 150000;
int swap;
char c;
srand((unsigned int)time(NULL));
for (unsigned int i = 0; i < line.length(); ++i) {
swap = rand()%line.length();
c = line[i];
line[i] = line[swap];
line[swap] = c;
} //for
output.open("output.txt");
output << line;
output.close();
system("notepad.exe output.txt");
system("del output.txt");
} //if
} //if
return 0;
} //main