formly-distributed pseudo-random number in the inclusive range
[ ` _ min  _ ` , ` _ max  _ ` ].

##  Syntax  ¶

    
    
    UNIFORM( <min> , <max> , <gen> )
    

Copy

##  Arguments  ¶

` _ min  _ `

    

A constant specifying the minimum value (inclusive) of the generated number.

` _ max  _ `

    

A constant specifying the maximum value (inclusive) of the generated number.

` _ gen  _ `

    

An expression that serves as a raw source of uniform random numbers, typically
the ` RANDOM  ` function. For more information, see the Data Generation
Functions [ Usage Notes  ](../functions-data-generation.html#label-rand-dist-
functions) .

##  Returns  ¶

If either or both of ` _ min  _ ` or ` _ max  _ ` is a floating-point number,
` UNIFORM  ` returns a floating-point number. If both ` _ min  _ ` and ` _ max
_ ` are integers, ` UNIFORM  ` returns an integer.

##  Usage Notes  ¶

This function is related to, but different from, the [ RANDOM  ](random)
function. Both functions generate uniform distributions, but there are
differences in the ranges of the values returned.

  * ` RANDOM  ` generates pseudo-random 64-bit integers. It accepts an optional seed that allows sequences to be repeated. 

  * ` UNIFORM  ` generates random integer or floating-point numbers in the specified range. 

##  Examples  ¶

    
    
    SELECT uniform(1, 10, random()) FROM table(generator(rowCount => 5));
    
    --------------------------+
     uniform(1, 10, random()) |
    --------------------------+
     6                        |
     4                        |
     7                        |
     9                        |
     4                        |
    --------------------------+
    

Copy

    
    
    SELECT uniform(0::float, 1::float, random()) FROM table(generator(rowCount => 5));
    
    ---------------------------------------+
     uniform(0::float, 1::float, random()) |
    ---------------------------------------+
     0.2895427479                          |
     0.7178660941                          |
     0.6925603163                          |
     0.05914526824                         |
     0.8243151404                          |
    ---------------------------------------+
    

Copy

    
    
    SELECT uniform(1, 10, 1234) FROM table(generator(rowCount => 5));
    
    ----------------------+
     uniform(1, 10, 1234) |
    ----------------------+
     7                    |
     7                    |
     7                    |
     7                    |
     7                    |
    ----------------------+
    

Copy

Was this page helpful?

Yes  No

[ Visit Snowflake ](https://www.snowflake.com)

[ Join the conversation ](https://community.snowflake.com/s/)

[ Develop with Snowflake ](https://developers.snowflake.com)

[ Share your feedback ](/feedback)

[ Read the latest on our blog ](https://www.snowflake.com/blog/)

[ Get your own certification ](https://learn.snowflake.com)

[ Privacy Notice ](https://www.snowflake.com/privacy-policy/) [ Site Terms
](https://www.snowflake.com/legal/snowflake-site-terms/) ©  2024  Snowflake,
Inc.  All Rights Reserved  .

On this page

  1. Syntax 
  2. Arguments 
  3. Returns 
  4. Usage Notes 
  5. Examples 

Language  :  **English**

  * [ English ](/en/sql-reference/functions/uniform)
  * [ Français ](/fr/sql-reference/functions/uniform)
  * [ Deutsch ](/de/sql-reference/functions/uniform)
  * [ 日本語 ](/ja/sql-reference/functions/uniform)
  * [ 한국어 ](/ko/sql-reference/functions/uniform)
  * [ Português ](/pt/sql-reference/functions/uniform)