Random Number Generator

  • Uploaded by: deianira
  • 0
  • 0
  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Random Number Generator as PDF for free.

More details

  • Words: 104
  • Pages: 1
Random Numbers Generator

/* This program generates random numbers between 0 and 65535.*/ import java.util.Random; import java.io.*; public class RandomNumbersGenerator { static int p; public static void main (String[] args) { read_keyboard(); RandomNumbersGenerator generator=new RandomNumbersGenerator(); } public static void read_keyboard(){ BufferedReader keyboard; try{ keyboard=new BufferedReader(new InputStreamReader(System.in),1); System.out.println("how many random numbers you want to generate:"); String s=keyboard.readLine(); p=Integer.parseInt(s); System.out.println("It will be generated "+p+" "+"random numbers between 0 and 65535 "); }catch(IOException e){ System.out.println("error while reading from keyboard.Sorry..."); } catch(NumberFormatException e1){System.out.println("Oh,for Heaven's sake!Give me a number!"); } } public RandomNumbersGenerator() { Random random_generator=new Random(); int[] random_numbers_array=new int[p]; for(int counter=0;counter

Related Documents


More Documents from ""

May 2020 18
Prefixoide
December 2019 12
Kirac-siyah Gece Lyrics
December 2019 17