Bonjour à tous, pourriez vous m'aider?

Voici mon controlleur

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
 
namespace projetBundle\Controller;
 
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
 
class DefaultController extends Controller
{
    /**
     * @Route("/")
     */
    public function indexAction()
    {
		$random = random_string(18);
        return $this->render('projetBundle:Default:index.html.twig', array(
			'pass' => $random,
		));
    }
 
	public function random_string($length)
	{
		$possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuvwz`~!@#$%^&*()_-+=|}]{[":;<,>.?/0123456789';
		for($i=0;$i<$length;$i++)
		{
			$char = substr($possible, mt_rand(0, strlen($possible) - 1), 1);
			$string .= $char;
		}
 
		return $string;
	}
}
J'ai l'erreur suivante
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Attempted to call function "random_string" from namespace "projetBundle\Controller".
J'ai l'impression que le controlleur ne trouve pas la fonction.
Je dois créer un service?

Merci de votre aide.