5 / 5 ( 1 vote ) To generate a random number in C#/CSharp, we make use of Random class. You can pass min and max value as parameter to its method called Next which will a generate number. The generated number will be within a range from min value and less than max value.
5 / 5 ( 1 vote ) To get host name of the local computer, we make use of GetHostName() method which resides in Dns class. Dns class is part of System.Net space. Example is given below. [crayon-5dd506557efc4739703711/]