Login     Register

        Contact Us     Search

XLeratorDB/math Documentation

SQL Server RANDBETWEEN function


RANDBETWEEN
 
Updated: 15 September 2010
Use RANDBETWEEN to calculate a random integer number between the numbers you specify. 
Syntax
SELECT [westclintech].[wct].[RANDBETWEEN] (
   <@Bottom, float,>
 ,<@Top, float,>)
Arguments
@Bottom
is the smallest integer that could be returned. @Bottom is an expression of type float or of a type that can be implicitly converted to float
 
@Top
is the largest integer that could be returned. @Top is an expression of type float or of a type that can be implicitly converted to float
 
Return Types
float
Remarks
·         @Top and @Bottom will be truncated to integers
·         RANDBETWEEN is non-deterministic, so results will vary
Example
 
SELECT wct.RANDBETWEEN(-100, 100)
Here is the result set
----------------------
-46
 

(1 row(s) affected)



Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service