Which language will help be design this idea.
Go to solution
Solved by WanderingFool,
Just adding a bit onto what I said earlier...a prizes excel sheet would be easy.
Column A: List of PrizesColumn B: # of each item (e.g. A1: Gold B1: 10, A2: Coal B2: 5....Gold shows up 10/15 times and Coal shows up 5/15 times). If you are more conformable with % then take a % and multiply by 100e.g. Gold at 50% = 5000Coal at 10.5% = 1050Diamond at 20.5% = 2050Topaz at 19% = 1900Column C:C1 =0C2 =B1+C1Use fill down in excel...ie just highlight from C2 down to C500 and click (ctrl-d) and it will autofill in for you. Basically it is counting the amount of items there are up until that pointColumn D:D1 =SUM(B:B)-1Total values (-1 because later we will need a number between 0 and sum-1)Column E:E1 =RANDBETWEEN(0,D1)Picking the random item's numberColumn F:F1 =MATCH(E1,C:C)Match will keep looking for a number that is like this E1 >= CSo F1 now contains the index that will match a prizeColumn G:G1 =INDEX(A:A,F1)Display the prize
This should work (works on mine). You should be able to easily copy and paste...and if you know a bit about excel, it should be easy to follow what is happening. If you need any help (or just want me to give you the excel file, let me know)
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now