Skip to content

Transition from mt_rand to random_int #9903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class::
*/
public function number($max)
{
$number = mt_rand(0, $max);
$number = random_int(0, $max);

return new Response(
'<html><body>Lucky number: '.$number.'</body></html>'
Expand Down
4 changes: 2 additions & 2 deletions page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ random) number and prints it. To do that, create a "Controller class" and a
{
public function number()
{
$number = mt_rand(0, 100);
$number = random_int(0, 100);

return new Response(
'<html><body>Lucky number: '.$number.'</body></html>'
Expand Down Expand Up @@ -248,7 +248,7 @@ variable so you can use it in Twig::
*/
public function number()
{
$number = mt_rand(0, 100);
$number = random_int(0, 100);

return $this->render('lucky/number.html.twig', array(
'number' => $number,
Expand Down