how can i generate different number,it is generating the same number
Random rand = new Random(100000);
rand.Next();
Model View Controller (MVC) MVC is a design pattern used to decouple user-interface (view), data (model), and application logic (controller). This pattern helps to achieve separation of concerns.
ASP.NET MVC is no longer in active development. The last version update was in November 2018. Despite this, a lot of projects are using ASP.NET MVC for web solution development. As to JetBrains' research, 42% of software developers were using the framework in 2020.
They are the same thing. C# is the language you have used to do your development, but ASP.NET MVC is the framework you used to do it.
It's really difficult to try and learn an entirely new language/framework under pressure. If you're required to deliver working software for your day job, trying to learn ASP.NET Core at the same time might be heaping too much pressure on yourself.
Just remove the seed number in the constructor. This seed is essentially a number from which the random number list is generated. If you specify a constant number, your random number list will always be the same.
Random rand = new Random();
rand.Next();
Your specifying the same seed try this.
Random rand = new Random();
rand.Next();
This will use the default seed which is the time.
"Initializes a new instance of the Random class, using a time-dependent default seed value."
As per MSDN : http://msdn.microsoft.com/en-us/library/system.random.aspx
Re your comment above, how to generate a "random" number in a set range.
// Generate and display 5 random integers from 50 to 100.
Console.WriteLine("Five random integers between 50 and 100:");
Console.Write("{0,8:N0}", rand.Next(50, 101));
(Taken from MSDN link above) You can now generate whatever range you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With