В стандартном модуле 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
🌸Beta Test Closing Announcement🌸
The Mystic Garden Beta Test has officially ended!
💎 Thank you to all the players who participated and helped shape the game. 🌱
🏆Winners List and rewards will be announced soon. Stay tuned for updates! 🚀
#MysticGarden#BetaTest#Web3Gaming
🚨 Mystic Garden Beta Test Reward Alert! 🚨
🌿 Dive into the enchanting world of Mystic Garden and claim your share of $500 AURA in rewards! 🌟
🎮 Beta Testers Wanted
💎 Exclusive prizes await 🌌
⏳ Don't miss the magic—beta testing opens soon!
#MysticGarden#BetaTest#Rewards
🌟How to Earn Crystals and Share $500 AURA in Mystic Garden?🌟
Beta Testers, this is your moment to shine! 🚀
🔹How to Share $500 AURA
• Harvest Crystals and sell them to earn GOLD.
• Rewards depend on the percentage of GOLD you contribute to the total GOLD from all players. 🏆
🔹Crystal Breakdown:
👉Tier 1 Elements🌱💧🔥🌬
• Earth, Water, Fire, Air
⏳ Growth Time: 1h - 1.5h
💎 Yield: 5-11 Crystals
🎁 Bonus Drop: 15-20% chance
👉Tier 2 Elements🪨⚙️🏖⚡️
• Combine Tier 1 to unlock:
Mud, Sand, Metal, Steam, Mist, Lightning
⏳ Growth Time: 2.5h - 8h
💎 Yield: 7-11 Crystals
👉Tier 3 Elements Coming Soon🌌
• Unlock combos like Light ☀️, Dark 🌑, Twilight!
🔔Leaderboard Mechanics:
• GOLD from selling Crystals determines your rank.
• Rewards are based on your GOLD percentage compared to all players. 🏅
Note: The parameters are not fixed, they will still be adjusted to always ensure suitability for the game!
The garden awaits. Grow and compete! 🌸
#MysticGarden#BetaTest#EarnRewards#CrystalLeaderboard
🎉 Our partner @chickizenTON is opening the Closed Beta Test phase to celebrate our partnership!
- Timeline: Now - 17:00 UTC , Jul 31, 2024.
- Whitelist: link
- Benefits: Exclusive Reward
#SingSing#Chickizen#BetaTest#Whitelist#GameRewards
📢 BETA TEST is coming soon!
We know you're itching to have a go and acquire your first CAThlete 🐷 Great news: gameplay development is progressing, and we're preparing a 💥playable beta💥!
We are grateful for your patience and will announce the start of beta testing in advance⏰ Stay tuned and don't miss out on the fun!
🐦 twitter: https://twitter.com/walken_io
🧨 medium https://medium.com/@walken.io
🕹️ discord https://discord.gg/QJDnFt6S4J
#nft#walken#walkandearn#NFTGaming#blockchaingame#betatest#betatester