Creating odds with the .sample in formula?

Say I wanted to have an attack that has a 90% chance of doing 10k damage and a 10% chance of doing 100k damage using the .sample in the formula.

Would the following: [10000,10000,10000,1000,10000,10000,10000,10000,10000,100000].sample

where there are nine 10,000 and one 100,000 achieve what I want to accomplish?

If there is a more efficient way, even if this would work, feel free to let me know.

Thanks.
Would the following...where there are nine 10,000 and one 100,000 achieve what I want to accomplish?
fastest way to see is to test it. you already have the formula
theres no reason it shouldnt if thats the use of Array.sample and it picks a random array element. i dont use ruby, but you must have gotten that from somewhere.

If there is a more efficient way, even if this would work, feel free to let me know.
Seeing as how theres only 2 outcomes with different odds of each, i would have used a ternary operator with a random number call to choose between the low roll and high roll 90% of the time. since the damage outcomes are 10k and 100k, you could also have it deal the low roll damage as a baseline and multiply it by 10, 10% of the time
You can just do a rand(10). Save it to a temporary value and check the value. If equals 9 do 100k otherwise do 10k
You can just do a rand(9). Save it to a temporary value and check the value. If equals 9 do 100k otherwise do 10k
How would I do that. I am not quite that advanced. Like how would I set up my formula to do that?
Edited - Some part of it would look like this:

rand(10) == 9 ? 100000 : 10000
You can just do a rand(9). Save it to a temporary value and check the value. If equals 9 do 100k otherwise do 10k
Small correction that rand(9) will only return 9 different results (from 0 to 8), you want to use rand(10) here.
Edited - Some part of it would look like this:

rand(10) == 9 ? 100000 : 10000
Thanks for the insight. Is there more to this, or is this the whole thing?
Well, if you want to paste it on the formula box instead of creating a method in Game_Battler class, you'd need to do something like the following:

dmg = rand(10) == 9 ? 100000 : 10000; Your calculation here including dmg
Edited - Some part of it would look like this:

rand(10) == 9 ? 100000 : 10000
This appears to work by itself. I tried it in a test battle against a test enemy and it does do the lower number most of the time, and occasionally the high number. Thanks

Original thread: https://forums.rpgmakerweb.com/threads/creating-odds-with-the-sample-in-formula.172317/