Leaky Bucket  

Posted in

#include"stdio.h"
#include"stdlib.h"
#include"math.h"

int t_rand(int a)
{
int m;
m=rand()%10;
m=m%a;
if(m==0)
m=1;
return m;
}

void main()
{
int o_rate,bufsize,i,maxtime,presentsize=0,rate;
clrscr();
printf("enter the buffer size,output rate and max time for transaction");
scanf("%d%d",&bufsize,&o_rate);
rate=o_rate;
maxtime=t_rand(4)*10;
for(i=0;ipresentsize)
o_rate=presentsize;
presentsize-=o_rate;
printf("the present size of bucket is %d after removing %d bytes\n\n",presentsize,o_rate);
}
getch();
}

This entry was posted at 10:26 AM and is filed under . You can follow any responses to this entry through the comments feed .

0 comments

Post a Comment

Reverse Engineering :Subscribe Now

Zts - ZTS

DISCLAIMER

This Blog is ONLY for educational purposes,
and any such codes/snippets provided are to be executed on
your sole discretion. The author is not responsible for the codes.