title: UndefinedFunctionException: Attempted to call function from namespace Controller
body: <p>I am trying to apply a security token using <a href="https://stackoverflow.com/questions/2593807/md5uniqid-makes-sense-for-random-unique-tokens">this code snipp from scott</a> but I can't seem to work it out in symfony2, here is my code:</p>
  
  <pre><code>&lt;?php
  
  namespace Acme\UserManagementBundle\Controller;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Symfony\Component\HttpFoundation\Response;
  
  class TokenController extends Controller
  {
  
      public function randSecureAction($min, $max) {
          $range = $max - $min;
          if ($range &lt; 0) return $min; // not so random...
          $log = log($range, 2);
          $bytes = (int) ($log / 8) + 1; // length in bytes
          $bits = (int) $log + 1; // length in bits
          $filter = (int) (1 &lt;&lt; $bits) - 1; // set all lower bits to 1
  
          do {
              $rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes)));
              $rnd = $rnd &amp; $filter; // discard irrelevant bits
          } while ($rnd &gt;= $range);
  
          return new Response ($min + $rnd);
      }
  
      public function getTokenAction($length=32) {
          $token = "";
          $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
          $codeAlphabet.= "abcdefghijklmnopqrstuvwxyz";
          $codeAlphabet.= "0123456789";
  
          for($i=0;$i&lt;$length;$i++) {
              $token .= $codeAlphabet[randSecureAction(0,strlen($codeAlphabet))];
          }
          return new Response ($token);
      }
  
  }
  </code></pre>
  
  <p>I create this TokenController as a service like <a href="https://stackoverflow.com/questions/15827384/how-to-access-a-different-controller-from-inside-a-controller-symfony2">this</a> so I can call it to my DefaultController, now the service can't call the other functions inside this controller, am I doing it wrong or there is a problem within my code because the function (getTokenAction) inside can't seem to use other function(randSecureAction) in the TokenController class.</p>