How to generate sample records from a file

i have a file having 30 million records.i want to generate a file having say 5% of total records in another file. the records in the new file shud be randomly generated.

awk 'BEGIN { srand() } rand() * 20 < 1' "$file"