|
| 19 Jun 2014 10:14 PM |
I want to do with mathematically.
table={1,2,3,3,3,4,5,6} ChanceThreeIsPicked=what? print(ChanceThreeIsPicked)
local num=table[math.random(#table)]
|
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Jun 2014 10:19 PM |
local possibilities = { 1, 2, 3, 3, 3, 4, 5, 6 } function oddsForValue(value) local total = 0 for _, val in pairs(possibilities) do if value == val then total = total + 1 end end return total / #possibilities end print(possibilities(3)) --> 3/8th or 0.375 or 37.5% |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 10:21 PM |
| That's assuming that every value has an equal chance to be picked. If you're using math.random(), then this is true. |
|
|
| Report Abuse |
|
|
Forlapse
|
  |
| Joined: 07 Jan 2014 |
| Total Posts: 122 |
|
|
| 19 Jun 2014 10:21 PM |
For that you need a good understanding of function dumps, and I would probably just make that a string, not a table.
http://wiki.roblox.com/index.php?title=Function_Dump/String_Manipulation |
|
|
| Report Abuse |
|
|