A
A
Alexey Sh2015-08-25 15:31:56
Database
Alexey Sh, 2015-08-25 15:31:56

How to make Random in T-SQL with negative and positive numbers?

I came across this problem:
Rand() * 100 for example, randomly displays numbers up to 100, and Rand() * ( - 100 ), from 0 to -100.
And how do you make them interspersed?
Of course, you can subtract one from the other, that is, if it turns out that the random number, which, as a minuend, is less than the random number, which is subtracted, then the number is negative, otherwise, then positive. But maybe there is some other function...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2015-08-25
@bondpuoq

Well the crutch level
(Rand() * 200) - 100

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question