-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomgen.cpp
51 lines (38 loc) · 864 Bytes
/
randomgen.cpp
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
51
#include <stdio.h>
#include <stdlib.h>
#include<time.h>
#include<iostream>
using namespace std;
int main(void)
{
srand(time(0));
int m = 1;
int hp = 12 * m;
int processors = 2;
int ntasks = 5; //perprocessor
double maxutilization = 0.9; //perprocessor
double minutilization = 0.2; //perprocessor
cout << ntasks*processors <<"\t" << hp << "\t" << processors << endl;
for (int j = 0; j < processors; j++)
for(int i = 0; i < ntasks;i++)
{
int p;
do
{
p = rand()%hp;
}while(p <=0);
double exec;
do
{
long int x = p * 10;
do{
exec = (rand()*rand()) % x;
exec/=10;
}while(exec <= 0.0);
}while (!( (exec/(double)p) < maxutilization/(double)ntasks && (exec/(double)p) > minutilization/(double)ntasks));
exec *= m;
p *= m;
cout << exec << "\t" << p << "\t" << j << endl;
}
return 0;
}