title: Yii random number generator function
body: <p>In yii i am creating random number generating function. I am using function as-</p>
  
  <pre><code>public function randomNumber()
  {
      //for generating random number
      $length =3;
      $chars = array_merge(range(0,9));
      shuffle($chars);
      $password = implode(array_slice($chars, 0,$length));
      echo $password;
  
  }
  </code></pre>
  
  <p>but in above function its creating random number as per length specified. i.e. if length is defined as 2, then it will create 2 digit number,if 3 then 3 digit number and so on. Now my condition is i want to generate random number between 1 to 1000. It can be 1 digit, 2 digit or 3 digit. So how to modify this function? Or is there any other way? Please help me...</p>