Hi

Add up the total amount of all resources for the whole object, and then divide each resource quantity by that number (skipping 0s)

0 521 147487 1459 204 0 0 0

total = 149671

0 0.00348 0.98540 0.00974 0.00136 0 0 0

then you can do a Math.random and go along adding them up untill you go over that value, and pick that one. eg

Math.random() = 0.5234

0 + 0.00348 < 0.5234 so carry on

0 + 0.00348 + 0.98540 >= 0.5234 so that is what they mined

in this case you are really heavily weighted to the metal ores, but I suspect that is the point, in the last case you will most likely end up on water when you go over the random value

I know I explained it like you are a 4 year old, but my explaination in text was really really bad, so I put in noddy examples of what I meant

As for returning nothing, I think unless you have a skill level attached to mining, then probably not, if you have some kind of skill level then you can just use that as an instant roll to work out if you even want to bother working out *what* they mined.

HTH

Endolf