Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating random -1 and +1 values in Excel

Tags:

random

excel

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?

like image 780
multigoodverse Avatar asked Feb 21 '13 21:02

multigoodverse


2 Answers

Easy:

=IF(RAND()<0.5,-1,1)

To get the real numbers, use

=RAND()*2-1
like image 71
Peter Albert Avatar answered Oct 13 '22 13:10

Peter Albert


Here is a solution:

=Randbetween(0,1)*2-1
like image 25
user2097212 Avatar answered Oct 13 '22 12:10

user2097212