Find all files with the extension .js in the entire file system, and replace the string "rand()" with "Math.random()" in each of those files.
find / -iname '*.js' -exec sed -i 'r/rand()/Math.random()/' {} \;