MySQL: Randomly Return 1 or -1

This randomly returns 1 or 0.

SELECT FLOOR(RAND()*2) 

Open in new window

I want it to randomly select 1 or -1
LVL 16
hankknightAsked:
Who is Participating?
 
Robert SchuttConnect With a Mentor Software EngineerCommented:
Try:
SELECT FLOOR(RAND()*2)*2-1

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.