C ++ not randomization
I'm not sure why I can't get diff values for my variables here, help!
int main()
{
srand(time(NULL));
srand48(time(NULL));
Packet* firstPacket = new Packet();
firstPacket->packetSize = randSize();
firstPacket->dest = randDest();
firstPacket->arrivalTime = myExp(lamb);
Host[firstPacket->dest].Frame.push_back(firstPacket); // adding first packet
Host[firstPacket->dest].numOfPack++;
calcFrameSize(Host[firstPacket->dest]);
cout << Host[token].frameTVTime << " " << Host[token].frameSize
<< " " << token << " " << curTime << endl;
}
0
a source to share
4 answers
this is what I have for other functions.
inline int randSize() { return (rand()%1518 + 64); }
inline int randDest() { return (rand()%10); }
inline float time(int size) { return (10.0*(float)size/12500); }
and this is what I have in the console:
~/152a/2phase$ ./phase2
0 0 1 0.01
0.5752 719 6 0.06
I am getting these numbers sequentially and I don't think there should be.
thanks.
0
a source to share