В стандартном модуле 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
Project Infinity X - Official | A14| Nothing Phone 2 (Pong)
📝 Details:
- Version: v1.6
- Device: #Pong
- Released: 25/10/24
⬇️ Download: Here
📖 Changelogs: Device | Source
📔 Instructions: Here
🎄 Device tree : Here
🖼 Screenshot : Here | Here
🆘 Support: Device
🏷 Tags: #AOSP#ROM#InfinityX#U#QPR3#Official
✍️ Note:
• Read changelogs
• OTA available
• Base firmware 2.6.0 is recommended
• Dirty flash possible from previous build
• Based on Qpr3 September Security Patch
• Dolby Atmos available
• Flash meteoric kernel for KSU support
• Nik gapps recommend for vanilla version
🏆 Credits:
- Chandu Dyavanapelli for DT Base
- Hellboy for kernel tree
- Fabian and Hellboy for Glyph Implementation
👤 Maintainer: @Ghosutox
🔔 Updates: @NothingPhone2Updates
🐙 Chat: @NothingPhone2
Project Infinity X - Official | A14| Nothing Phone 2 (Pong)
📝 Details:
- Version: v1.5
- Device: #Pong
- Released: 11/09/24
⬇️ Download: Here
📖 Changelogs: Device | Source
📔 Instructions: Here
🎄 Device tree : Here
🖼 Screenshot : Here | Here
🆘 Support: Device
🏷 Tags: #AOSP#ROM#InfinityX#U#QPR3#Official
✍️ Note:
• Read changelogs
• Base firmware 2.6.0 is recommended
• Dirty flash possible from previous build
• Based on Qpr3 September Security Patch
• Dolby Atmos available
• Flash meteoric kernel for KSU support
• Nik gapps recommend for vanilla version
🏆 Credits:
- Chandu Dyavanapelli for kernel & DT Base
- Fabian and Hellboy for Glyph Implementation
👤 Maintainer: @Ghosutox
🔔 Updates: @NothingPhone2Updates
🐙 Chat: @NothingPhone2
Project Infinity X - Official | A14| Nothing Phone 2 (Pong)
📝 Details:
- Version: v1.4
- Device: #Pong
- Released: 27/08/24
⬇️ Download: Here
📔 Instructions: Here
🎄 Device tree : Here
🖼 Screenshot : Here | Here
🆘 Support: Device
🏷 Tags: #AOSP#ROM#InfinityX#U#QPR3#Official
✍️ Note:
• Initial official release
• Base firmware 2.6.0 is recommended
• Clean flash mandatory
• Based on Qpr3 August Security Patch
• Dolby Atmos available
• Flash meteoric kernel for KSU support
• Nik gapps recommend for vanilla version
🏆 Credits:
- Chandu Dyavanapelli for kernel & DT Base
- Fabian and Hellboy for Glyph Implementation
👤 Maintainer: @Ghosutox
🔔 Updates: @NothingPhone2Updates
🐙 Chat: @NothingPhone2