Benford's law is not working? So I recently came across Benford's law and immediately tried to code it out but the answer I got was rather confusing. I've been thinking about it for about an hour now and still can't get it,  I think my code is correct I'm pretty sure it is but the result is just not the one others get. Here's the code:
float[] a=new float[10000],flag=new float[10];

for(int i=0;i&lt;10000;i++)
  {
    a[i]=floor(random(0,99999));
      if(a[i]&gt;10000)
         a[i]=floor(a[i]/10000);   
      if(a[i]&gt;1000)
         a[i]=floor(a[i]/1000);
      if(a[i]&gt;100)
         a[i]=floor(a[i]/100);
      if(a[i]&gt;10)
         a[i]=floor(a[i]/10);
    
      for(int k=1;k&lt;10;k++)
       {
          if(a[i]==k)
            flag[k]++;
       }

  }

Though I get roughly the same flag[k] (around 1100) but according to Benford's law that should not be the case. Can someone help me tell how my code is wrong?
That's because for the numbers from 10,000 to 99,999 the first digit is equally likely, same for numbers from 1,000 to 9,999 etc.
Benford's law depends on random numbers whose logarithm has a linear distribution over a not too small range. Take random numbers x from 0 to 999,999, then calculate 10^(x/200000) and you'll find that Benford's law will hold.
But measure the height of adult people in feet, and 95% start with 5 or 6, a few percent start with 4, and very few with 7 or 3. It's not a law that applies to every set of numbers. (Measure people in meters, and 98% start with 1, a few with 2, and very few start with a 9 or even 8. )