| 12
 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
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 
 | void GenerateVoiceRandomly(int tab[1200])
{
int i;
	//	printf("\nk=%d\n",k);
	for(i=0;i<1200;i++)
		{
		//printf("foo2");
		//Unicity(tab,i);
		tab[i]=randint(0,8619);
		//printf("voice[%i] = %d \n",i,tab[i]);
		if(tab[i]>8619) printf("tab[%d]Random=%d",i,tab[i]);
		}
}
 
 
 
int TestPeriodT(int k)
{
//	printf("ktest=%d ",k);
	int b=k;
	while(k>8619)
	{
		k=k-8620;
	}
	//test if this function is working
	//if(b==8620)
	//{
//		printf(" ksortie=%d\n",k);
	//}
 
	return k;
 
 
}
 
// simulate one voice call at 64kb/s
int ArrivalFromVoiceInput(int k)
{
	int VoiceCircuit[1200],i;
	if(k==0)
	{
		GenerateVoiceRandomly(VoiceCircuit);
	}
 
	int x;
	x=k;
	//return k between 0 and 8619, we are taking into accound the periodicity of 
	//the cell from the voice input
	if(k>8619)
	{
	x=TestPeriodT(k);
	}
 
	for (i=0;i<1200;i++)
	{
	if(VoiceCircuit[i]>8619) printf("tab[%d]Random=%d",i,VoiceCircuit[i]);
	//printf("voiceBoucle[%i] = %d \n",i,VoiceCircuit[i]);
		if(VoiceCircuit[i]==x) 
		{//printf("voice[%i] = %d \n",i,VoiceCircuit[i]);
		//printf("valeur de k = %d\n",x);
			return 1 ;}
	}
	return 0;	
 
 
} | 
Partager