Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save maskaravivek/98095de7ba4994a97f7036302f8092d8 to your computer and use it in GitHub Desktop.

Select an option

Save maskaravivek/98095de7ba4994a97f7036302f8092d8 to your computer and use it in GitHub Desktop.
import java.util.Random;
public class RandomExample {
public static void main(String[] args) {
Random rand = new Random();
int randomNumber = rand.nextInt(100) + 1; // 1 to 100
System.out.println("Random number: " + randomNumber);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment