# MLContext(Nullable<Int32>) Constructor

## Definition

Create the ML context.

public MLContext (int? seed = default);
new Microsoft.ML.MLContext : Nullable<int> -> Microsoft.ML.MLContext
Public Sub New (Optional seed As Nullable(Of Integer) = Nothing)

#### Parameters

seed
Nullable<Int32>

Seed for MLContext's random number generator. See the remarks for more details.

## Remarks

Many operations in ML.NET require randomness, such as random data shuffling, random sampling, random parameter initialization, random permutation, random feature selection, and many more. MLContext's random number generator is the global source of randomness for all of such random operations.

If a fixed seed is provided by seed, MLContext environment becomes deterministic, meaning that the results are repeatable and will remain the same across multiple runs. For instance in many of ML.NET's API reference example code snippets, a seed is provided. That's because we want the users to get the same output as what's included in example comments, when they run the example on their own machine.

Generally though, repeatability is not a requirement and that's the default behavior. If a seed is not provided by seed, i.e. it's set to null, MLContext environment becomes non-deterministic and outputs change across multiple runs.

There are many operations in ML.NET that don't use any randomness, such as min-max normalization, concatenating columns, missing value indication, etc. The behavior of those operations are deterministic regardless of the seed value.

Also ML.NET trainers don't use randomness *after* the training is finished. So, the predictions from a loaded model don't depend on the seed value.