1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <iostream>
#include <conio.h>
#include <string>
#include <Windows.h>
#include <ctime>
using namespace std;
int main()
{
int Prng(int Max);
cout << Prng(1000);
_getch();
}
int Prng(int Max)
{
int Key[5][10] =
{{792,12,387,1032,749,472,825,952,395,21},
{21,383,492,341,764,519,364,8964,998,554},
{8564,865,345,1,83,232,72,978,132,419},
{529,21,893,529,893,69,4972,8590,750,553},
{3458,7,83,9134,8235,6835,936,5613,759,3453}};
int long unsigned Times=rand(), Number=rand();
srand((unsigned)time(0));
for(int Loop=0;Loop<Times;Loop++)
{
int Slot1=rand()%5, Slot2=rand()%10, Equation=rand()%4+1;
switch(Equation)
{
case 1:
Number=Number+Key[Slot1][Slot2];
break;
case 2:
Number=Number-Key[Slot1][Slot2];
break;
case 3:
Number=Number/Key[Slot1][Slot2];
break;
case 4:
Number=Number*Key[Slot1][Slot2];
break;
}
}
return Number%Max+1;
}
|