Skip to content

Instantly share code, notes, and snippets.

@lamprosg
Created March 3, 2012 20:04
Show Gist options
  • Save lamprosg/1967924 to your computer and use it in GitHub Desktop.
Save lamprosg/1967924 to your computer and use it in GitHub Desktop.
Erlang B Equation - Traffic units and busy probability on GSM gateways
// Javascript: Percentage of busy
// calls with a=traffic and n lines
function erl(a,n)
{
u=1;
for(i=1;i<=n;i++)
{
u+=power(a,i)/factorial(i);
}
return((power(a,n)/factorial(n))/u+0.005)*100
}
function factorial(i) // Get factorial of i
{
k=1;
for (j=1; j<=i; j++)
{
k*=j;
}
return k
}
function power(k,i) // Compute k power i
{
w=1;
for (j=1; j<=i; j++)
{
w*=k;
}
return w
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment