Find all files in the current directory and its subdirectories, then use awk to generate a random 4-digit number and save each file with the generated number as its name.
find ~ -name '*' | awk 'BEGIN {srand()} {f=sprintf("%04d",int(rand()*10000)); print $0 > f}'