random pass generator

random pass generator

View Answers

July 17, 2009 at 3:32 PM

Hi Friend,

Try the following code:

import java.io.*;
import java.util.*;
import java.net.*;

public class NamePass {
public static void main(String[] args)throws Exception {
FileReader inStream,inStream1;
BufferedReader in,in1;

String passwords="";
String pass="";
String name="";
Random r = new Random();
int[] integers = new int[20];
for (int i = 0; i < integers.length; i++) {
integers[i] = r.nextInt(10000000);
}
for (int i : integers) {
passwords+=Integer.toString(i)+"\n";
}

File myFile = new File("passwords.dat");
FileOutputStream outStream = new FileOutputStream(myFile);
PrintWriter out = new PrintWriter(outStream);
out.println(passwords);
out.close();
String p[]=new String[20];
String n[]=new String[20];

inStream1 = new FileReader(myFile);
in1 = new BufferedReader(inStream1);
String passwordData="";
for (int i=0;i<20;i++){
p[i]=in1.readLine();
pass+=p[i];
}

inStream= new FileReader("names.dat");
in = new BufferedReader(inStream);
for (int i=0;i<20;i++){
n[i]=in.readLine();
name+=n[i];
}


java.util.List<String> list = new ArrayList<String>();
for(int i = 0; i < n.length; i++) {
String line = n[i]+" "+p[i];
list.add(line);
}
System.out.println(list);
writeToFile(list, "NamePass.dat");
}
private static void writeToFile(java.util.List<String> list, String path) {
BufferedWriter out = null;
try {
File file = new File(path);
out = new BufferedWriter(new FileWriter(file));
for (String s : list) {
out.write(s);
out.newLine();
}
out.close();
} catch(IOException e) {}
}
}

Thanks









Related Tutorials/Questions & Answers:
random pass generator - Java Beginners
random pass generator  Write a program (name the program and class... inStream,inStream1; BufferedReader in,in1; String passwords=""; String pass=""; String name=""; Random r = new Random(); int[] integers = new int[20
ModuleNotFoundError: No module named 'django-random-id-generator'
ModuleNotFoundError: No module named 'django-random-id-generator'  Hi...: No module named 'django-random-id-generator' How to remove the ModuleNotFoundError: No module named 'django-random-id-generator' error? Thanks
Advertisements
ModuleNotFoundError: No module named 'random-password-generator'
ModuleNotFoundError: No module named 'random-password-generator'  Hi...: No module named 'random-password-generator' How to remove the ModuleNotFoundError: No module named 'random-password-generator' error? Thanks  
ModuleNotFoundError: No module named 'random-bode-generator'
ModuleNotFoundError: No module named 'random-bode-generator'  Hi...: No module named 'random-bode-generator' How to remove the ModuleNotFoundError: No module named 'random-bode-generator' error? Thanks   Hi
ModuleNotFoundError: No module named 'random-csv-generator'
ModuleNotFoundError: No module named 'random-csv-generator'  Hi...: No module named 'random-csv-generator' How to remove the ModuleNotFoundError: No module named 'random-csv-generator' error? Thanks   Hi
ModuleNotFoundError: No module named 'random-name-generator'
ModuleNotFoundError: No module named 'random-name-generator'  Hi...: No module named 'random-name-generator' How to remove the ModuleNotFoundError: No module named 'random-name-generator' error? Thanks   Hi
ModuleNotFoundError: No module named 'random-password-generator-cli'
ModuleNotFoundError: No module named 'random-password-generator-cli'  ...: No module named 'random-password-generator-cli' How to remove the ModuleNotFoundError: No module named 'random-password-generator-cli' error
ModuleNotFoundError: No module named 'django-random-id-generator'
ModuleNotFoundError: No module named 'django-random-id-generator'  Hi...: No module named 'django-random-id-generator' How to remove the ModuleNotFoundError: No module named 'django-random-id-generator' error? Thanks
ModuleNotFoundError: No module named 'funny-random-name-generator'
ModuleNotFoundError: No module named 'funny-random-name-generator'  ...: No module named 'funny-random-name-generator' How to remove the ModuleNotFoundError: No module named 'funny-random-name-generator' error? Thanks
Generating Random Number
generator's sequence. If you pass a value to the method then the method return... number in sequence according to the random number generator. Here is the code... Generating Random Number     
PHP Simple password generator
PHP Simple password generator In this tutorial I will be showing you how to create a random password using nothing but loops and random letters. For extra... the loop of creating it, using the $min and $max we can get a random length
Random classes
Random classes  Hello... What is Random class? What's the purpose
Random classes
Random classes  Hello... What is Random class? What's the purpose
Random classes
Random classes  Hello... What is Random class? What's the purpose
PASS value
PASS value  javascript to pass value to other html file
random numbers - Java Beginners
java.util.*; class RandomNumberExample { static Random generator = new Random...random numbers  write a program to accept 50 numbers and display 5...(); System.out.println("Random numbers are: "); int random[]=new int[5]; for(int i=0;i
random number
random number  Sir could u please send me the code registration form of roseindia.net with image varification
random number
random number   Please How do I generate a program that gives me random integer from 115 to 250? Using java.util.random. Thank you very much!  ... main(String[] args){ int min = 115; int max = 250; Random random
random numbers
random numbers  hi.. i am creating a website and on feedback form to authenticate user i want to generate a random number on label.if user types that number correctly in textbox then he is allowed to submit feedback otherwise
random numbers - Java Beginners
RandomNumberExample { static Random generator = new Random(); public static int get (int[] array...random numbers  Hello i need this code to be modified for me to display the random numbers, but not twice or more. I mean i need a number
Pick at Random
the entry from the array before selecting another name at random
Random Access File.
Random Access File.  Explain Random Access File
random numbers
random numbers  Hi I need some help with the code for the this program. This program should randomly choose a number between 1 and 1000, and then challenge the user to guess what it is, giving hints ('too high!' or 'too low
pass method reference in java
pass method reference in java  How to pass method reference in Java
Is Java pass-by-reference?
Is Java pass-by-reference?  Is Java pass-by-reference
Generate random numbers in Java
generator class. Random(long seed): This constructor is used to create random number...Generate random numbers in Java - How to use the java.util.Random class to generate desired random number in Java program? In this tutorial I will teach you
J2ME Random Number
this random number generator's sequence and the setSeed method is used to sets the seed of this random number generator using a single long seed and finally... J2ME Random Number      
using random number
using random number  generate a 10 digit number using random number and display the length of longest increasing series
PHP Pass Post Data
PHP Pass Post Data  How to pass POST data to the PHP-CGI
JavaScript pass arguments
JavaScript pass arguments   How to pass dynamic arguments to the functions in JavaScript
understanding buttons :JSP random no program
understanding buttons :JSP random no program  I hav java random no generator program but i need to implement it in JSP such that page generates random no between 100 and 200 on loading and on clicking submit button it ives
ModuleNotFoundError: No module named 'Pass'
ModuleNotFoundError: No module named 'Pass'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pass' How to remove the ModuleNotFoundError: No module named 'Pass' error
ModuleNotFoundError: No module named 'Pass'
ModuleNotFoundError: No module named 'Pass'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pass' How to remove the ModuleNotFoundError: No module named 'Pass' error
Random Access File class
Random Access File class  Write a short note on Random Access File class.   Please visit the following link: Java Random Access File
you pass a variable by value.
you pass a variable by value.  How do you pass a variable by value... $a = &$b /*--------------Pass By value----------------*/ function add($a) { return ++$a; } add($a); /*---------------Pass by reference
Generator in Hibernate
Generator in Hibernate  What is the generator in hibernate
Pass by Reference - Java Beginners
Pass by Reference  Hi Friends, What is Pass by value and Pass by Reference?can u please explain with examples.is java supports Pass by reference?  Hi Friend, Pass By Value: It refers to pass the variables
getting random number in java
getting random number in java  getting random number in java Hi everyone, i am trying to get a random number in a particular range. for example random numbers between 1 to 100 in Java. Though i m new to Java, i have tried many
Version of taglibs>random dependency
List of Version of taglibs>random dependency
Random data - Java Beginners
Random data  hi friend, I want to ask how to make random data. i has example word like this : Gaza! Gaza! Palestina merdeka! how to make random like : Azag! Azag! Anitselap akedrem! thank's
Generate Random Numbers
Generate Random Numbers  hi,,, Please give me answer with example How do you generate random numbers within a given limit with actionscript... This function generate random numbers with in given limit
RANDOM ACCESS FILE CONCEPT
RANDOM ACCESS FILE CONCEPT  In a random access file, first write the alphabets a,b, c, d till z. Read the file in reverse order and print it on screen
using random number
using random number  generate 10 number and display the length of longest incresing series
using random number
using random number  generate 10 digit number and display the length of longest incresing swries
Can I pass a
Can I pass a   Suppose I have servlet named Name.java and there is a variable String name holding a value "Roseindia". I have collected the value to Getname.jsp via ajax. Now how can I pass this value to scriplet without page
pass parameter names and values
pass parameter names and values  What is the <jsp:param> standard action?   The <jsp:param> standard action is used with <jsp:include> or <jsp:forward> to pass parameter names and values
Maven Repository/Dependency: crypto-random | crypto-random
Maven Repository/Dependency of Group ID crypto-random and Artifact ID crypto-random. Latest version of crypto-random:crypto-random dependencies. # Version Release Date You can read more
Random in jsp
Random in jsp          Random numbers are the numbers that are determined entirely by chance. User does not have any control over the working of random numbers
objective c pass by value
objective c pass by value   How to pass value by reference in objective c?   - (void)parentFunction { int i = 0; [self... to be able to modify i, you would have to pass the value of the reference by doing
java pass by reference
java pass by reference  i understood java always pass arguments by pass by value so that the original value does not change...... but i want to know how we change the value and make it effect the original value by passing

Ads