You can try
//for integers
Random r = new Random();
int rInt = r.Next(0, 100);
//for doubles
int range = 100;
double rDouble = r.NextDouble()* range;
Have a look at
Random Class, Random.Next Method (Int32, Int32) and Random.NextDouble Method
More Related Contents:
- How can I generate random alphanumeric strings?
- Generating random, unique values C#
- Best way to randomize an array with .NET
- Why use the C# class System.Random at all instead of System.Security.Cryptography.RandomNumberGenerator?
- Generate N random and unique numbers within a range
- Generating a Random Decimal in C#
- Random slot algorithm
- Pros and cons of RNGCryptoServiceProvider
- How to get random values from array in C# [duplicate]
- Is there a difference between “throw” and “throw ex”?
- How do ValueTypes derive from Object (ReferenceType) and still be ValueTypes?
- Why does my .NET 4 application know .NET 4 is not installed
- How can I get all classes within a namespace?
- Why can’t a duplicate variable name be declared in a nested local scope?
- How to stop BackgroundWorker correctly
- Checking if a bit is set or not
- Random weighted choice
- How to get timestamp of tick precision in .NET / C#?
- How to avoid System.IO.PathTooLongException?
- Windows.Forms.Timer OR System.Threading.Timer
- .net XML Serialization – Storing Reference instead of Object Copy
- What is the purpose of nameof?
- Singleton by Jon Skeet clarification
- Exception when AddWithValue parameter is NULL
- TraceRoute and Ping in C#
- Exclude a field/property from the database with Entity Framework 4 & Code-First
- Find image format using Bitmap object in C#
- How to create a C# Winforms Control that hovers
- Why does struct alignment depend on whether a field type is primitive or user-defined?
- How to get DPI in C# .NET?