-
-
Save parzibyte/6419fb97d8507bd26a39f7b071137f97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Demostración de la generación de | |
números aleatorios en C# | |
usando Random | |
@author parzibyte | |
*/ | |
using System; | |
class MainClass { | |
public static void Main (string[] args) { | |
Random random = new Random(); | |
// Recuerda que el segundo argumento es el límite | |
// superior exclusivo | |
// Entre 1 y 10 | |
int numero = random.Next(1, 11); | |
Console.WriteLine(numero); | |
// Entre 1 y 2 | |
numero = random.Next(1, 3); | |
Console.WriteLine(numero); | |
// Entre 50 y 200 | |
numero = random.Next(50, 201); | |
Console.WriteLine(numero); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment