使用Bash在给定的特定数字范围内生成随机浮点数 [英] Generate random float number in given specific range of numbers using Bash

查看:128
本文介绍了使用Bash在给定的特定数字范围内生成随机浮点数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我生成bash(shell)中具有给定特定数字范围的随机浮点数吗?我发现下面的命令,但他们还有其他选择吗? (使用awk或$ rand命令.)

can someone help me in generating random float number with given specific range of number in bash (shell). I found below command but is their any other option ? (using awk or $rand commands.)

jot -p2  0 1

推荐答案

如果有可用的GNU coreutils,则可以使用:

If you have GNU coreutils available, you could go with:

seq 0 .01 1 | shuf | head -n1 

这篇关于使用Bash在给定的特定数字范围内生成随机浮点数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆