Pass an upper limit as an argument to the rand() function.
Input:
my $upper_limit = 100;
my $random = rand($upper_limit);
print $random . "\n";
Output:
A random floating-point number, like...
45.8733038119139
Symfony 2.8
# AppBundle\Twig\AppExtension.php
<?php
namespace AppBundle\Twig;
class AppExtension extends \Twig_Extension
{
/**
* This is where one defines the filters one would to use in their twig
* templates
*
* @return Array
*/
public function ...