Hello.I'm working on a d20 based game system and I'm pretty new to python.What I've done so far is:
create 6 random rolls with values 3-18
rollOne
rollTwo
rollThree etc.
There are 6 stats that need theese rolls assigned
statOne
statTwo
etc.
I've done the part on how to assign rolls and it works,but:
What can I do to prevent using same roll for two stats?(eg.rollOne can be used for statOne and other stats,and it shouldn't).thank you.for complete source code and further explications contact me by e-mail muntean.horia@yahoo.com
Horia.Muntean 0
Newbie Poster
Recommended Answers
Jump to PostThe easiest way to do this is to use python's inbuilt random library, with the randint function. This function takes two integers, which define the range between which you want to get a random number.
You can use it like so:
from random import * def …
Jump to PostWhat can I do to prevent using same roll for two stats?
Append the random rolls to a list and use each value in the list once only. If I misunderstand and this is not what you want, then post back.
import random ## random can come …
All 6 Replies
aot 0
Junior Poster in Training
Horia.Muntean 0
Newbie Poster
woooee 814
Nearly a Posting Maven
aot 0
Junior Poster in Training
Horia.Muntean 0
Newbie Poster
Horia.Muntean 0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.