SQL Server gets the random number function rand () and rand (x)

Source: Internet
Author: User

--rand (x) returns a random floating-point value of V, in the range between 0~1 (that is, 0<=v<=1.0)

--If an integer parameter x is specified, it is used as the seed value, and the same seed number will produce a repeating sequence. If the same seed value calls the RAND function multiple times, it returns the same build value

Example: Select rand (), RAND (), Rand ();

Results: 0.664547768839536 0.0166045240927059 0.0892182701370623

--Rand () without parameters has a different value each time.

Select Rand (TEN), Rand (11);

Results: 0.713759689954247 0.713759689954247 0.713778322925506

--When Rand (x) has the same parameters, it produces the same random number, with different X-generated random values

SQL Server gets the random number function rand () and rand (x)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.