Does the MySQL/MariaDB RAND() Function Take Arguments?

burnedfaceless
burnedfaceless used Ask the Experts™
on
Does the MySQL/MariaDB RAND() function take an argument, and if it does, what does it do?

I've tried entering numbers and it still just gives me a number between 0 and 1.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Developer
Commented:
hmm, read the RAND() reference:

Returns a random floating-point value v in the range 0 <= v < 1.0. To obtain a random integer R in the range i <= R < j, use the expression FLOOR(i + RAND() * (j − i)). For example, to obtain a random integer in the range the range 7 <= R < 12, use the following statement:

It takes an INT as parameter, which means that it uses a fixed given seed.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial