8000 minor #9903 Transition from mt_rand to random_int (sbol-coolblue) · symfony/symfony-docs@998659e · GitHub
[go: up one dir, main page]

Skip to content

Commit 998659e

Browse files
committed
minor #9903 Transition from mt_rand to random_int (sbol-coolblue)
This PR was submitted for the master branch but it was squashed and merged into the 2.8 branch instead (closes #9903). Discussion ---------- Transition from mt_rand to random_int Considering that mt_rand has a warning notice surrounding it, having the examples use random_int nudges people in the direction of the more secure way of generating random ints, building better habits. Commits ------- 2e68ee7 Transition from mt_rand to random_int
2 parents 2b3d22b + 2e68ee7 commit 998659e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class::
6868
*/
6969
public function numberAction($max)
7070
{
71-
$number = mt_rand(0, $max);
71+
$number = random_int(0, $max);
7272

7373
return new Response(
7474
'<html><body>Lucky number: '.$number.'</body></html>'

page_creation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ random) number and prints it. To do that, create a "Controller class" and a
5353
*/
5454
public function numberAction()
5555
{
56-
$number = mt_rand(0, 100);
56+
$number = random_int(0, 100);
5757

5858
return new Response(
5959
'<html><body>Lucky number: '.$number.'</body></html>'
@@ -123,7 +123,7 @@ variable so we can render that::
123123
*/
124124
public function numberAction()
125125
{
126-
$number = mt_rand(0, 100);
126+
$number = random_int(0, 100);
127127

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

0 commit comments

Comments
 (0)
0