bpo-40465: Deprecate the optional argument to random.shuffle(). (#19867)

diff --git a/Lib/random.py b/Lib/random.py
index 8f840e1..f2c4f39 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -321,6 +321,10 @@
                 j = randbelow(i+1)
                 x[i], x[j] = x[j], x[i]
         else:
+            _warn('The *random* parameter to shuffle() has been deprecated\n'
+                  'since Python 3.9 and will be removed in a subsequent '
+                  'version.',
+                  DeprecationWarning, 2)
             _int = int
             for i in reversed(range(1, len(x))):
                 # pick an element in x[:i+1] with which to exchange x[i]
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index 6d87d21..bb95ca0 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -103,7 +103,8 @@
         shuffle = self.gen.shuffle
         mock_random = unittest.mock.Mock(return_value=0.5)
         seq = bytearray(b'abcdefghijk')
-        shuffle(seq, mock_random)
+        with self.assertWarns(DeprecationWarning):
+            shuffle(seq, mock_random)
         mock_random.assert_called_with()
 
     def test_choice(self):