Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
On bash
echobc -l <<< "scale=4 ; $((RANDOM % 10000 ))/10000" | bc -l
where 1/10000 is your random precision and 4 digits your output precision
1/10000
4
echo "scale=4 ; $((RANDOM % 10000 ))/10000" | bc -l
where 1/10000 is your random precision and 4 your output precision
bc -l <<< "scale=4 ; $((RANDOM % 10000 ))/10000"
echo "scale=4 ; $((RANDOM % 100010000 ))/1000"10000" | bc -l
where 1/100010000 is your random precision and 4 your output precision
1/100010000
echo "scale=4 ; $((RANDOM % 1000 ))/1000" | bc -l
where 1/1000 is your random precision and 4 your output precision
1/1000