В стандартном модуле random есть две очень похожие функции
random.randint()
random.randrange()
Обе возвращают случайное значение из указанного диапазона
>>> random.randint(10, 20)
12
>>> random.randrange(10, 20)
17
В чем же отличие?
Дело в том что у randrange() есть третий параметр step.
randint() действительно возвращает случайное число из указанного диапазона.
randrange() на первый взгляд делает тоже самое если передать также два параметра.
Но есть указать еще и step то наш диапазон усложняется, то есть в него попадёт не полный ряд значений.
Например, я хочу получить случайное значение из диапазона но только чётное число. Тогда достаточно сделать так:
>>> randrange(10, 20, 2)
16
Таким образом получается что randint это частный случай randrange без указания параметра step.
Еще одно важное отличие в том, что randint() включает в диапазон второе значение а randrange() нет. То есть выражение randrange(10, 20) никогда не вернёт 20, а randint(10, 20) вернёт.
#tricks#basic
📰 Wine 11.8 Brings Mono Engine Update and 22 Bug Fixes
Wine 11.8 updates Mono to version 11.1, improves MSXML and VBScript support, and fixes 22 bugs across games and Windows apps.
🔗 Source: https://linuxiac.com/wine-11-8-brings-mono-engine-update-and-22-bug-fixes/
#wine
Ancient factory exposes secrets of winemaking
A 1,500-year-old wine factory the size of a modern-day football field has been unearthed in Israel, showing how vintners met demand for high quality white wine popular throughout the ancient world.
#News#Reuters#Israel#Wine
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
📰 Proton 11.0 Beta 2 Updates VKD3D-Proton
Following the release of Proton 11.0 Beta 1 from two weeks ago that updated against Wine 11.0, this heart to Valve's Steam Play is now out with a second beta release...
🔗 Source: https://www.phoronix.com/news/Proton-11.0-Beta-2
#proton#steam#wine
Early Roman women were forbidden to drink wine, and a husband who found his wife drinking was at liberty to kill her. The prohibition stemmed from a deeply patriarchal society that viewed women as weak and susceptible to vice, believing that wine could lead them to "inappropriate behavior" or "debauchery".
@googlefactss#alcohol#wine#history#nowyouknow