Created
April 11, 2013 14:49
-
-
Save yoku0825/5363991 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql55> CREATE FUNCTION rrand (start INT, end INT) RETURNS INT NO SQL RETURN RAND() * (end - start) + start; | |
Query OK, 0 rows affected (0.00 sec) | |
mysql55> SELECT rrand(1, 3); | |
+-------------+ | |
| rrand(1, 3) | | |
+-------------+ | |
| 2 | | |
+-------------+ | |
1 row in set (0.00 sec) | |
mysql55> SELECT rrand(1, 3); | |
+-------------+ | |
| rrand(1, 3) | | |
+-------------+ | |
| 3 | | |
+-------------+ | |
1 row in set (0.00 sec) | |
mysql55> SELECT rrand(1, 3); | |
+-------------+ | |
| rrand(1, 3) | | |
+-------------+ | |
| 1 | | |
+-------------+ | |
1 row in set (0.00 sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment