How to generate random numbers! 
Author Message
 How to generate random numbers!
How to generate random number values in range  {1,2,3} using Transact SQL ?
Using RAND function I realized that I need to pass seed value as argument,
but didn't see how to get desired range of generated numbers.


Mon, 10 Oct 2005 16:45:54 GMT
 How to generate random numbers!

CAST(RAND()*3 AS INTEGER)%3+1

--
David Portas
------------
Please reply only to the newsgroup
--


Quote:
> How to generate random number values in range  {1,2,3} using Transact SQL
?
> Using RAND function I realized that I need to pass seed value as argument,
> but didn't see how to get desired range of generated numbers.



Mon, 10 Oct 2005 16:52:32 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. need help - generating random numbers

2. Need Script to generate random numbers

3. How to generate random numbers?

4. SQL to Generate Random Numbers?

5. Isn't GUID supposed to generate random numbers?

6. How to generate random number (up to 7 digits) in Oracle?

7. EASY: SQL to generate a simple random number?

8. generating a random number

9. Generating Random Numbers

10. generating a random number with duplicate records

11. Generating Random Numbers

12. Generating random numbers mixed with strings


 
Powered by phpBB® Forum Software