SqlFunctions.Rand Method

Definition

Returns a pseudo-random float value from 0 through 1, exclusive.

Overloads

Rand()

Returns a pseudo-random float value from 0 through 1, exclusive.

Rand(Nullable<Int32>)

Returns a pseudo-random float value from 0 through 1, exclusive.

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see RAND (Transact-SQL).

Rand()

Returns a pseudo-random float value from 0 through 1, exclusive.

public:
 static Nullable<double> Rand();
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "RAND")]
public static double? Rand ();
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "RAND")>]
static member Rand : unit -> Nullable<double>
Public Shared Function Rand () As Nullable(Of Double)

Returns

The pseudo-random value.

Attributes

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see RAND (Transact-SQL).

Applies to

Rand(Nullable<Int32>)

Returns a pseudo-random float value from 0 through 1, exclusive.

public:
 static Nullable<double> Rand(Nullable<int> seed);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "RAND")]
public static double? Rand (int? seed);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "RAND")>]
static member Rand : Nullable<int> -> Nullable<double>
Public Shared Function Rand (seed As Nullable(Of Integer)) As Nullable(Of Double)

Parameters

seed
Nullable<Int32>

The seed value. If seed is not specified, the SQL Server Database Engine assigns a seed value at random. For a specified seed value, the result returned is always the same.

Returns

The pseudo-random value.

Attributes

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see RAND (Transact-SQL).

Applies to