

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
I am calling RAND() function two times in the same query then will it generate same random number two times or will it generate two different random numbers?
We know that MySQL RAND() returns a random floating point value between the range of 0 and 1. It will generate two different random numbers if we will call the RAND() function, without seed, two times in the same query. Following example will make it clearer −
Example
mysql> Select RAND(), RAND(), Rand(); +--------------------+-------------------+--------------------+ | RAND() | RAND() | Rand() | +--------------------+-------------------+--------------------+ | 0.9402844448949066 | 0.911499003797303 | 0.7366417150354402 | +--------------------+-------------------+--------------------+ 1 row in set (0.00 sec)
The above result set shows that RAND() function will generate different random number every time we call it.
- Related Questions & Answers
- How to generate random numbers between two numbers in JavaScript?
- How can I generate two separate outputs using Random in Java
- How can we generate the same sequence of random numbers in MySQL?
- Generate random numbers in Arduino
- Generate random numbers using C++11 random library
- Generate pseudo-random numbers in Python
- Generate Random Integer Numbers in Java
- In SAP UI5 render calling two times in custom control
- What happens if I will add a UNIQUE constraint on the same column for multiple times?
- How does Python generate random numbers?
- Java program to generate random numbers
- Largest Number By Two Times in Python
- Is it possible to utilize $addToSet multiple times in the same update?
- Generate Random Long type numbers in Java
- Generate random characters and numbers in JavaScript?
Advertisements