In the docs it is mentioned that -random without any parameters should give 10 pages.
-random Work on random pages returned by [[Special:Random]]. Can also be given as "-random:n" where n is the number of pages to be returned, otherwise the default is 10 pages.
-randomredirect Work on random redirect pages returned by [[Special:RandomRedirect]]. Can also be given as "-randomredirect:n" where n is the number of pages to be returned, else 10 pages are returned.
But in reality it gives infinite pages.
Example:
$ python ../pywikibot-core/pwb.py download.py -ns:File -random Retrieving 50 pages from commons:commons. File:Wallpaper group-p4-1.jpg File:Volvo740.jpg File:Stabsmusikkorps.png ### And many more files ### Retrieving 50 pages from commons:commons. File:Gardenology.org-IMG 7300 hunt09jun.jpg File:Heard-Lakeman House, Ipswich MA.jpg File:PL Eliza Orzeszkowa-Z różnych sfer t.1,2 534.jpeg File:Optasani OT.vechea bis lemn.ochi de fereastra.jpg ### And many more files ### Retrieving 50 pages from commons:commons. etc. ...