Thank you so much bro. It was a nice explanation and the best part is you made it look so simple. Keep up the good wok
@yaroslavnochnyk33824 жыл бұрын
Thank you so much! This video helped me a lot with my test task for the interview! :D Very useful!
@ColinPaddock6 жыл бұрын
Because String objects are immutable, each concatenation is going to create a whole new String, which is a bad habit to build if you have any intention of doing anything large-scale. There is a String(char[]) constructor, which can do what that second loop does rather more cleanly. It’s also a waste of time to create a random string of zero length, so line 15 in your modified version should be int length = rand.nextInt(14) + 1; , which will produce a random string of length 0
@teejay7933 жыл бұрын
Hi, how can I input the random character generated in a text field on a web page?
@Digas27PT5 жыл бұрын
I had problems with the initialize of the variable i. I use a text editor and the prompt command at linux and it says that cannot find the variable i. I've write it like it was in the video. What is the matter where?? I appreciate your help, thx!!!
@bashardd9254 Жыл бұрын
great video! helped me Thanks!
@zeeshanhayder355915 күн бұрын
Thanks Andrew
@olenaieriomina41066 жыл бұрын
Thank you very much for this video!
@alexandercalderon30406 жыл бұрын
You could've added "randomString += text[i];" in the first loop.
@UniProgrammer6 жыл бұрын
Yes, good catch. That would work too. In this instance I was keeping the steps simple to show its functionality.
@ColinPaddock6 жыл бұрын
You could also have skipped creating the array in that case. Simply make the contents of the first loop randomString += characters.charAt(rand.nextInt(characters.length()));
@ColinPaddock6 жыл бұрын
That would once again have the problem of creating myriads of superfluous String instances, so it’s still better to build the array and then use the String constructor overload with the char array input. This also avoids creating the superfluous empty String at the start.
@diegorecinos20716 жыл бұрын
Great video!! helps a lot!!
@astiginko4 жыл бұрын
mate what if its a random generated id number? should i change the string to int? then what should be the numbers like 0-10000?
@musyrics-music91615 жыл бұрын
thanks can you help by implementing this on captcha(offline)
@xMrTdLx4 жыл бұрын
The modified version of your code generates a random string from 0 - 15. How would you go about it, if you wanted your code to generate a random string that has a character length of 14 -19?
@saurabhsharma35864 жыл бұрын
can we generate all possible combination throw random. you are printing only one combination. but i want to print all possible combination. like(ABCD, ABCE,ACED..............) SO ON. CAN YOU HELP ME ON THIS.
@charjofra60323 жыл бұрын
how would you do this but in a while loop?
@piper56m356 жыл бұрын
great video! helped me a lot
@user-ec6ej4dp6t Жыл бұрын
This makes sense but does not solve what is expected of me with my project currently. Teacher wants me to have 3 words and then generate random output of the 3 words
@UniProgrammer Жыл бұрын
Instead of the full alphabet, you could set the list of characters to be the three words. This can be done dynamically from user input or hard-coded prior to execution.
@nourmidan20906 жыл бұрын
thanks dud really helped
@UniProgrammer6 жыл бұрын
Glad to hear! Thanks
@KashGamingReal6 жыл бұрын
Nice video!!!
@behindthescenex7 жыл бұрын
thank you so much for the video andrew ! i'm sorry to ask you again. i've got one more question, if i got an array of string like this : String [ ] symbols = {"heart", "diamond", "clubs", "spades"}; how can i random the values of the array ? i've tried to loop the values and then stored it on an array list, but still i've got incompatible types message. here's my code : String [] symbol = {"heart" , "diamond" , "clubs" , "spades"}; Random rand = new Random(); ArrayList store = new ArrayList (); for(int i = 0; i < symbol.length; i++ ){ store.add(rand.nextInt(symbol[i])); } could you help for this ? sorry to make trouble andrew, thank you so much for the tutorial once again :))
@DRsewage6 жыл бұрын
String[] symbol = {"thing1", "thing2", "thing2"}; Random rand = new Random(); System.out.println(symbol[rand.nextInt(symbol.length)]); Something like that. You dont need to make another Array for that, or I just dont know what you want to achive. and instead of System.out you can just write something like String CPU = symbol[rand.nextInt(symbol.length)]; And that's it. If its for the game I quess..
@kirkvanhouten37194 жыл бұрын
Thank you so much Bro !!!
@AngelyteMaina4 жыл бұрын
THANK YOU!THANK YOU! THANK YOU!
@czs1995114 жыл бұрын
how about length 0
@mohammadtariq12885 жыл бұрын
It's a good vedio, but little bit complicated.
@meer_shahrukh74413 жыл бұрын
thanks Man
@aljimsonmegrino95805 жыл бұрын
why theres no output when i try to run it sir??
@aljimsonmegrino95805 жыл бұрын
hehehe i figured it out ...thank u
@josemunguia56606 жыл бұрын
Thanks bro!
@prod.s236 жыл бұрын
It only did 1 thing
@przemekrosiak31634 жыл бұрын
thx a lot!!
@nanomeows3 жыл бұрын
what the frick frack
@ldelaprade6 жыл бұрын
This is amateur: No insurance 2 calls return different names. Serious programmer had better search for open source java class GUIDGenerator
@UniProgrammer6 жыл бұрын
Laurent de Laprade Thanks for your constructive feedback. However this tutorial set is intended for programmers who are at the beginner level. Hence I used concepts only covered in the beginning stages of my java tutorials. Additionally, understanding the fundamental concepts of programming is much more important for a beginner programmer than being the most efficient. Efficiency comes with knowledge and experience... not java tutorial videos.