title: Random level function in skip list
body: <p>I am looking at <a href="http://en.literateprograms.org/Skip_list_%28Java%29" rel="nofollow">skip list implementation in Java</a> , and I am wondering the purpose of the following method:</p>
  
  <pre><code>public static int randomLevel() {
      int lvl = (int)(Math.log(1.-Math.random())/Math.log(1.-P));
      return Math.min(lvl, MAX_LEVEL);
  }
  </code></pre>
  
  <p>And what the difference between the above method and </p>
  
  <pre><code>Random.nextInt(6);
  </code></pre>
  
  <p>Can anyone explain that? Thanks.</p>