@@3omarhd878 say you want a random integer from 30-100. If we say int max = 100; and int min = 30; when we take the difference of those two, we will be passing 70 into the nextInt method. Note that this will only find a random number from 0-69 now, so we must add 1 inside the parentheses. Our value will now be between 0-70. Adding the min integer afterwards then allows us to generate a number from 30-100.
These videos are super helpful for self taught beginner! I'm not native English speaker but I could follow your tutorials without any problem thanks to your clear explanation. Thank you so much! I would like to join your class if you have one.
I´m not a native English speaker but this guy explains super! I mean I can understand English and this guy does and describes his hobby very understandable.
Im so happy my friend sent me to your channel, im 32 and ready to have a career change. I have been so addicted to java since starting these video's! thank you brO!
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
Me le coding: Random rand = new Random(); String s = rand.nextString(); RUclips.out.comment(s); RUclips: Channel recommendation improved... Me: Wow it worked... 😍🙏
I've always just used Math.random() and for a dice I normally just do double randomDouble = Math.random() * 6; and then do integer randomInt = (int)randomDouble; and then randomInt++;
I am so excited because new shrek movie was announced by the official twitter page saying Morbin' time is over and its time for shrek to play some shreksophone
I'm not even good at english ethier at programming but i really like this channel it help me allot to understand java even when he speak English I'm so grateful that i found you broo thank you so much 🙏
I already know alot about programing so the first like 5 vids becuz i know about Strings variables Char boolean etc. but after that it gets realy exiting i realy like java and i would love to master it and with you its so much easy thanks alot
The Random Hypotenuse 😁😁😁 import javax.swing.JOptionPane; import java.util.Random; public class Main { public static void main(String[] args) { Random random = new Random(); int x = random.nextInt(100); System.out.println("value of x : " + Math.abs(x)); int y = Math.abs(random.nextInt(100)); System.out.println("value of y : " + y); int z = (int) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); System.out.println("The Hypotenuse is : " + z); } }
RNG! import java.util.Random; /*Brandon (Insert Last Name Here) *March 27, 2021 *Intro to RNG */ public class RandomValues { public static void main(String[] args) { Random random = new Random(); int x = random.nextInt(6) + 1; double y = random.nextDouble(); boolean z = random.nextBoolean();
Hi,how can i generate a string where the first two characters are letters while the rest are numbers(example: "AX10532"). I need this to generate vehicle license plates.
What I would do is to create a string of all the characters you want to use: String myString = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" Use the random class to create random integers randomNum = random.nextInt(10) randomLetter = random.nextInt(26)+10 Then use the myString.charAt(randomNum) method to pick a random number from the string myString.charAt(randomLetter) method to pick a random letter from the string
If you increase the min value this code give errors. import java.util.Random; public class RandomNumber2 { // If the min > 1 some things is wrong after many turns comes over max limit public static void main(String[] args) { int error = 0; int min = 2; int max = 6; Random random = new Random(); for (int x = 1; x < 1000; x++) { int randomNumber = random.nextInt(max) + min;// Limited the range // double y = random.nextDouble(); // boolean z = random.nextBoolean(); System.out.println(randomNumber); if (randomNumber > max) { System.out.println("ERROR over limit"); error++; } } System.out.println(error + " ERRORS"); } }
import java.util.Random;
public class Main {
public static void main(String[] args) {
Random random = new Random();
int x = random.nextInt(6)+1;
//double y = random.nextDouble();
//boolean z = random.nextBoolean();
System.out.println(x);
}
}
I am unable to convert it into int . It is showing that random cannot be converted to int
This code is giving error
Can we generate random character
"Random random, equals new random. That's random."
Wise words from our savior.
wise words from a wise man
random.nextInt(max - min + 1) + min ; //creates number between two numbers
cant understand can someone say more details ?
@@3omarhd878 say you want a random integer from 30-100. If we say int max = 100; and int min = 30; when we take the difference of those two, we will be passing 70 into the nextInt method. Note that this will only find a random number from 0-69 now, so we must add 1 inside the parentheses. Our value will now be between 0-70. Adding the min integer afterwards then allows us to generate a number from 30-100.
Nice
@@domenicdemski1436 thank you
@@3omarhd878 gotchu
These videos are super helpful for self taught beginner!
I'm not native English speaker but I could follow your tutorials without any problem thanks to your clear explanation.
Thank you so much! I would like to join your class if you have one.
I´m not a native English speaker but this guy explains super! I mean I can understand English and this guy does and describes his hobby very understandable.
Everything after Bro Code teaches becomes easy.
Im so happy my friend sent me to your channel, im 32 and ready to have a career change. I have been so addicted to java since starting these video's! thank you brO!
I'm so glad I found you! Straight to the point and well explained. Thank you so much!
The random double numbers have various usages for example statistics , probability etc.
Ty
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
Me le coding:
Random rand = new Random();
String s = rand.nextString();
RUclips.out.comment(s);
RUclips: Channel recommendation improved...
Me: Wow it worked... 😍🙏
I love you classes bro, it really helps
These videos are super helpful for self taught beginner!
I've always just used Math.random() and for a dice I normally just do double randomDouble = Math.random() * 6; and then do integer randomInt = (int)randomDouble; and then randomInt++;
Why not just cast it in the first one
int random =(int)(Math.random()*6);
thx for vids !
I am so excited because new shrek movie was announced by the official twitter page saying Morbin' time is over and its time for shrek to play some shreksophone
how random of you!
I cant helpt it but returning to your videos whenever I wanna learn programming. Thanks Bro!
I'm not even good at english ethier at programming but i really like this channel it help me allot to understand java even when he speak English I'm so grateful that i found you broo thank you so much 🙏
Now I know how random number generation works for different data types. Thanks.
Finally answers without a need to read 10 pages manual.
This is GOOD !!! Variety of JAVA courses.
"Random random, equals new random. That's random."
I agree. Thats random.
Thanks! :) I would like to see videos about kotlin :) , But this java course I really like it :).
Very helpful videos, thank you!!
I wish I wanna go past and all my teachers are be like him 🥺
Such a great explanation lot's of Gratitude to you " BRO "
This Randomness of the Universe really is helping me
Hey brother, you are a genius, I wish you all the best, thank you
decided to make it do 100, got a 69 on my 3rd roll. Worth it
sigma grindset
I can make my own random number generator! I know this is kid stuff, but I'm so ridiculously happy right now.
Nobody:
Random: Curd would book a star had the Oscars seen Additional Mouse Properties.
I already know alot about programing so the first like 5 vids becuz i know about Strings variables Char boolean etc. but after that it gets realy exiting i realy like java and i would love to master it and with you its so much easy thanks alot
Giga Chad thumbnail in 2020? Very Chad like.
How can i generate a random value between -6 to 6 for example?
int max = 6;
int min = -6;
int x = random.nextInt((max+1) + max) + min;
thank god for these channels dude... even tho im a atheist ! this video has 4 minutes but explains a lot !
thank you for great lesson
Thanks for the help before the test.
int x= random.nextInt(6)+8 what happens then??
You get a random number between 7 and 12
Random understood. 8th. Thank you, ma Bro Sensei!
Nice tutorial you got there :D
Superb my Random bro
thx for the knowledge!
love for helping you beat algorithem.
Thanks bro great tutorial !
Your videos are informative and interesting
The Random Hypotenuse 😁😁😁
import javax.swing.JOptionPane;
import java.util.Random;
public class Main {
public static void main(String[] args) {
Random random = new Random();
int x = random.nextInt(100);
System.out.println("value of x : " + Math.abs(x));
int y = Math.abs(random.nextInt(100));
System.out.println("value of y : " + y);
int z = (int) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
System.out.println("The Hypotenuse is : " + z);
}
}
very short and helpful video
string comment = random.nextOpinion();
Sysout(comment, "Java is a girl, so descriptive");
Best channel ever!
3:40 made me lol
This is the best video I have ever seen
doing my part for the algorithm AGAIN while (watching bro code){smash that like button};
Love these! New binge inc
"a random comment"
one of the best class
Moment of silence for the poor souls who disliked our Bros Videos. All of you 15,928 ungrateful viewers as well.
thx i learnt dfro u again
hello, i would like to generate a random number from a specific set for example { 1,6,77,90,39 } how would i code it?
Hi, Did you make it?
@@PedroSilva-rn6ux just generate a random number-index, by which you get the desired number from the list
hello this video was super helpful, can you please tell me how you changed your background to dark mode? @Bro Code
There is the first video about java, so at the end of it you can find this info.
how do i take range as an input from user
Boolean
Foolean
Toolean
Coolean
Poolean
Woolean
ellerinize sağlık güzel olmuş. kısa ve öz
Guys please how to give that number a percentage for not showing up
1:18 Really Random!
@Bro Why we write. (6)+1;
We are taking 6 values for a dice so 0 - 6 = 7 values +1 = 8
Is it ??
Random(6); means Start from 0 to end at 6 ......
Random(6)+1; means Start from 1 to end at 6 .......
@@dildosti7769 Random(6); means Start from 0 to end at 5*
I want to play video games, but my father won't let me do it because he thinks that it's Satan's thing
Drop a pseudo-random comment guys !!!
Thank you.
RNG!
import java.util.Random;
/*Brandon (Insert Last Name Here)
*March 27, 2021
*Intro to RNG
*/
public class RandomValues {
public static void main(String[] args) {
Random random = new Random();
int x = random.nextInt(6) + 1;
double y = random.nextDouble();
boolean z = random.nextBoolean();
System.out.println(x);
System.out.println(y);
System.out.print(z);
}//end of main
}//end of class
Very good Video :)
thanks for watching Creeper!
Striaght to the point
Thanks bro👍
I love this guy!
blue jeans and bloody tears
hi, bro!
thank you very much
I have written the same code using intelliJ but error comes???
Make sure either you are importing the Library or not
Thanks bro!
How to generate random numbers between 0 to 1?
what name this program so i can download it
Thnaks
Good Work Bruh!!
Arigato!!
Thank you soooo much !!!
Glad it helped!
Hi,how can i generate a string where the first two characters are letters while the rest are numbers(example: "AX10532"). I need this to generate vehicle license plates.
What I would do is to create a string of all the characters you want to use:
String myString = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Use the random class to create random integers
randomNum = random.nextInt(10)
randomLetter = random.nextInt(26)+10
Then use the
myString.charAt(randomNum) method to pick a random number from the string
myString.charAt(randomLetter) method to pick a random letter from the string
@@BroCodez this is a year old but its pretty cool you reached out with such a specific answer, real bro code
@@BroCodez I tried to compile this but I got a error. Maybe I'm stupid.
Thanks to your question I was able to get some good practice! Here is how I did it
String myString = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Random randomNum = new Random();
String newString =
String.valueOf(myString.charAt(randomNum.nextInt(10)+26))
+ String.valueOf(myString.charAt(randomNum.nextInt(10)+26))
+ String.valueOf(myString.charAt(randomNum.nextInt(10)))
+ String.valueOf(myString.charAt(randomNum.nextInt(10)))
+ String.valueOf(myString.charAt(randomNum.nextInt(10)))
+ String.valueOf(myString.charAt(randomNum.nextInt(10)))
+ String.valueOf(myString.charAt(randomNum.nextInt(10)));
//"String.valueOf" converts char to String
System.out.println(newString);
Thank you
Can anyone explain how random.nextInt(6)+1 gives us a range of 1-6? I thought we’d now be getting a range of 0-7
I'm not 100 percent sure either buy maybe since the starting value is always 0, then by adding +1, it changes the starting value to 1? 🤔
@@bryanZ17 Yup, makes sense. Thank you
What is the purpose of
Scanner.close();
to close the scanner class imported from java
Excellent Bro ☺♥
thank u soo much u help me lot
Thank you bro
this code is very useful for me
If you increase the min value this code give errors.
import java.util.Random;
public class RandomNumber2 {
// If the min > 1 some things is wrong after many turns comes over max limit
public static void main(String[] args) {
int error = 0;
int min = 2;
int max = 6;
Random random = new Random();
for (int x = 1; x < 1000; x++) {
int randomNumber = random.nextInt(max) + min;// Limited the range
// double y = random.nextDouble();
// boolean z = random.nextBoolean();
System.out.println(randomNumber);
if (randomNumber > max) {
System.out.println("ERROR over limit");
error++;
}
}
System.out.println(error + " ERRORS");
}
}
You are the best! I am italian if you want i'll take you pizza hahah.
nice one bro
Hello
Thanks
Nice Bro ;)
another great one
you are amazing!
4:20 A random comment
Randomizers, eh?
how i can do random letters ?, like random password
what if randomness was random this random thought makes no sense and is therefor a random comment. XD
thanks