Randomly select a number between 1 and 20, and then use the "dirname" command to get the directory of the file "file.txt" located in the directory "some" which is located in the directory with the randomly selected number.
shuf -i 1-20 -n 1 | sudo xargs -I % dirname ~/%/some/file.txt