# Random Number

A value selected by a generator so its next result is difficult to predict casually.

## What is **Random Number** in C#?

**Random Number** — A value selected by a generator so its next result is difficult to predict casually.

```csharp
class Dice
{
    Random random = new();

    int Roll()
    {
        return random.Next(1, 7);
    }
}
```

Level: Apprentice · [More C# terms at this level](https://www.ask-codey.com/glossary/subjects/c-sharp/apprentice)

Updated: September 27, 2026

## In other subjects

- [Random Number in Java](https://www.ask-codey.com/glossary/random-number)

Source: https://www.ask-codey.com/glossary/random-number-c-sharp
