So I am developing a large game where you are in charge of a toy store, and you can buy toys and whatnot. Now I am trying to create something where when I go to start the day, the program would first have a max amount of customers and then a random amount of customers between 1 and max, A. This is all working fine. The part i'm having troubles with is when I go to randomize how much stock is sold. So say I have 15 Plastic Toy, and 5 Lego Sets. So I should be able to sell a random number between 0 and 15 for the Plastic Toys, but I have a max amount of customers who can buy toys, only 1 per. So say my max amount of customers was 10, I randomized it and got 5. Then say I randomized Plastic Toys, and I got 13. I can't do this obviously, because there aren't enough customers. So I need a way to make it random between 0 and Max for the toys, but then a higher MAX of customers.
If anyone knows some code I could use, any help would be appreciated.
Thanks!
This is the part of code:
D+1->D
"A is the total amount of customers you can have
randInt(1,A)->A
Lbl D1
randInt(0,P)->V
If P>A
Then
Goto D1
Else
A-V->A
P-V->P
M+(15*V)->M
End
Lbl D2
randInt(0,L)->W
If W>A
Then
Goto D2
Else
A-W->A
L-W->L
M+(45*W)->M
End
Lbl D3
randInt(0,T)->X
If X>A
Then
Goto D3
Else
A-X->A
T-X->T
M+(103*X)->M
End
Lbl D4
randInt(0,I)->Y
If Y>A
Then
Goto D4
Else
A-Y->A
I-Y->I
M+(245*Y)->M
End
Lbl D5
randInt(0,S)->Z
If Z>A
Then
Goto D5
Else
A-Z->A
S-Z->S
M+(600*Z)->M
End
Text(~1,1,1,"DAY: ",D
Text(11,1,"Total Customers: ",A
Text(18,1,"Plast Toys Sold: ",V
Text(25,1,"Lego Sets Sold: ",W
Text(32,1,"Metal Toys Sold: ",X
Text(39,1,"Bicycles Sold: ",Y
Text(46,1,"Swings Sold: ",Z