Ya no necesitas indagar más en otras webs porque has llegado al sitio necesario, tenemos la solución que quieres encontrar y sin liarte.
Ejemplo 1: generador de números aleatorios c #
Random rnd =newRandom();
int month = rnd.Next(1,13);// creates a number between 1 and 12
int dice = rnd.Next(1,7);// creates a number between 1 and 6
int card = rnd.Next(52);// creates a number between 0 and 51
Ejemplo 2: generador aleatorio de c #
// One string will be randomly picked and displayed Random rnd =newRandom();
string[] secOptions ="string one","string two","string three";
int randomNuber = rnd.Next(0,3);
string secText = secOptions[randomNuber];Console.WriteLine(secText);
Ejemplo 3: generar nombre aleatorio c #
privatevoidRandName()
string[] maleNames =newstring[1000]"aaron","abdul","abe","abel","abraham","adam","adan","adolfo","adolph","adrian";
string[] femaleNames =newstring[1000]"abby","abigail","adele","adrian";
string[] lastNames =newstring[1000]"abbott","acosta","adams","adkins","aguilar";Random rand =newRandom(DateTime.Now.Second);if(rand.Next(1,2)==1)FirstName= maleNames[rand.Next(0, maleNames.Length-1)];elseFirstName= femaleNames[rand.Next(0, femaleNames.Length-1)];
Ejemplo 4: generador de números aleatorios c #
Random numberGen =newRandom();
int amountToOutput =4;
int minimumRange =1;
int maximumRange =20;for(int i =0; i < amountToOutput; i++)
int randomNumber = numberGen.Next(minimumRange, maximumRange);Console.WriteLine(randomNumber);
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)