在Excel中生成随机-1和+1值 [英] Generating random -1 and +1 values in Excel
本文介绍了在Excel中生成随机-1和+1值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Rand()
函数将生成0到1之间的实数。
Rand between(-1,1)
将生成-1,0或1.
我想要的只有-1或1.
和-1和1之间的实数如何?
The Rand()
function would generate a real number between 0 and 1.
The Randbetween(-1,1)
would generate either -1, 0, or 1.
What I want is only -1 or 1.
And what about real numbers between -1 and 1?
推荐答案
简单:
=IF(RAND()<0.5,-1,1)
要获取实际数字,请使用
To get the real numbers, use
=RAND()*2-1
这篇关于在Excel中生成随机-1和+1值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文