title: Javasctipt class pattern with repeating class name
body: <p>I want to emulate classes in javascript, and have come up with this scheme...</p>
  
  <pre><code>var Random = function(a){ // class name used here
      var Random = function(a){ // and used again here
          this.valueOf = function(){
              return Math.random()
          }
          this.under = function(limit){
              return this*limit
          }
          this.floor = function(limit){
              return Math.floor(this*limit)
          }
      }
      return new Random(a)
  }
  
  var rnd = Random()
  
  console.log(rnd*20&lt;&lt;0)
  </code></pre>
  
  <p>The naming seems quite conventional to me, with class names in TitelCase and instances in camelCase. I wrap the class twice, so that I can return an instance, as I don't like using <code>new Thing</code> in my main code.</p>
  
  <p>The thing that strikes me as most unusual is using the same class name for both wrappers. Is there any technical problem with this pattern?</p>
  
  <p>Is there a simpler way to achieve the same thing?</p>