Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variable Help
saito100 Offline
Junior Member

Posts: 15
Threads: 8
Joined: Jul 2013
Reputation: 0
Variable Help

Ok, so this is my problem. I'm wondering how I could randomly generate an amount of numbers while staying in a limit for the total of all of them. So say I have four variables. (2, 5, 2, 3 (This is what I would like it to look like.)) And they all are randomly generated and they can't go above a certain condition but they have to meet it. (Being 12 for this case.) My question is firstly how would you fairly generate these numbers without certain variables being oped in a sense. As in when its generating the first one it could for all we know make it nine and then there's only a total of 3 more you can add before the condition is reached.
The first variable would be oped to the other ones which I do not want. I still want it to be random but make it so that they're spread out somewhat. Because if it generated the numbers in order then each variable after another would become smaller and smaller before some would have to be zero in some cases. Then what else i'm wondering is how would you make it so when they are generated they DO reach the goal. Not just stay under it but reach it. Sorry if i'm making this sound confusing but i'm very tired atm. Tongue But if anyone has any idea please leave a reply saying what you think I could do. Thank you! Big Grin
(This post was last modified: 11-15-2013, 04:58 PM by saito100.)
09-20-2013, 10:31 PM
Your Computer Offline

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
RE: Variable Help


Tutorials: From Noob to Pro
09-20-2013, 11:25 PM
Website Find

Users browsing this thread: 1 Guest(s)