Create a program RandomFile.java that generates files with random numbers/characters.
You arerequired to write the following three methods in the classRandomFile:
​publicstatic void randomBinaryFile(StringfileName,int length)
​publicstatic void randomNumberFile(StringfileName,intlength)
​publicstatic void randomCharFile(StringfileName,int length)
The parameter “fileNameâ€specifies the file name, and “length†specifies the length of thesequence in the file.
â— randomBinaryFile will generatea file containing a sequence of 0 or 1 of the specifiedlength;
◠randomNumberFile will generatea file containing a sequence of digits 0, 1, 2, …, 9 of thespecified length;
◠randomCharFile will generatea file containing a sequence of characters A, B, C, …, Z of thespecified length;
Also write a main()method to test your code. In the main()method, you may ask the user to type in a file name, a type ofrandomness (binary, digit or character), and the length of thefile.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The following code generates a random character between A andZ:
​​Randomr = new Random();​​
​​chara = (char) (r.nextInt(26)+ 'A');
Another way is as below:
Random r = new Random();​​
String alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";
char a = alphabet.charAt(r.nextInt(26));