You can unlock metal detector after depth 250, each time you open a chest you generate a random number from 0-999, this random number determines your rewards.For a metal detector this number has to be less than 915 or, if you don't own a metal detector then less than 945.There's also another function which gives you a metal detector after depth 250 in a 1/100 chance from a basic chest.I'm not 100% sure why there are two different functions for handling the metal detector reward.