Is it possible to limit the numbers of the rng?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
- Regular
- Posts: 36
- Joined: Wed Jul 06, 2011 11:23 am
- Projects: Tony T (Writer, programmer)
- Location: Under your chair >8D
- Contact:
Is it possible to limit the numbers of the rng?
Im using the renpy.random.random code... but... is it possible to limit the range of numbers that the code uses?
Bashing my head against the computer desk while programming since march 2011, and so far no brain damashii nanananananananana katamari damashii
- PyTom
- Ren'Py Creator
- Posts: 16088
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Is it possible to limit the numbers of the rng?
Yes. renpy.random has all of the functions in the Python random module. You probably want renpy.random.randint. For example, renpy.random.randint(1, 20) picks an integer between 1 and 20, inclusive, like a die would.
(What do you mean, most people's dice are 6 sided?)
(What do you mean, most people's dice are 6 sided?)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Regular
- Posts: 36
- Joined: Wed Jul 06, 2011 11:23 am
- Projects: Tony T (Writer, programmer)
- Location: Under your chair >8D
- Contact:
Re: Is it possible to limit the numbers of the rng?
Wow.. an answer from PyTom himself...
Thank you, that will really help me
Thank you, that will really help me
Bashing my head against the computer desk while programming since march 2011, and so far no brain damashii nanananananananana katamari damashii
Who is online
Users browsing this forum: GetOutOfMyLab, Majestic-12 [Bot], VESTED