@@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(); TH-cam.out.comment(s); TH-cam: 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); } }
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"); } }
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();
The Random Hypotenuse GUI Form 😁😁😁 import javax.swing.JOptionPane; import java.util.Random; public class Main { public static void main(String[] args) { Random random = new Random(); int a = random.nextInt(20) + 1; JOptionPane.showMessageDialog(null, " a : " + a); int b = random.nextInt(20) + 1; JOptionPane.showMessageDialog(null, " b : " + b); double c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)); JOptionPane.showMessageDialog(null, "The Hypotenuse is : " + c); } }
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!
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
The random double numbers have various usages for example statistics , probability etc.
Ty
Me le coding:
Random rand = new Random();
String s = rand.nextString();
TH-cam.out.comment(s);
TH-cam: 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++;
Why not just cast it in the first one
int random =(int)(Math.random()*6);
I cant helpt it but returning to your videos whenever I wanna learn programming. Thanks Bro!
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!
Now I know how random number generation works for different data types. Thanks.
thx for vids !
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 wish I wanna go past and all my teachers are be like him 🥺
Such a great explanation lot's of Gratitude to you " BRO "
3:40 made me lol
Finally answers without a need to read 10 pages manual.
This Randomness of the Universe really is helping me
This is GOOD !!! Variety of JAVA courses.
decided to make it do 100, got a 69 on my 3rd roll. Worth it
sigma grindset
"Random random, equals new random. That's random."
I agree. Thats random.
Hey brother, you are a genius, I wish you all the best, thank you
Thanks! :) I would like to see videos about kotlin :) , But this java course I really like it :).
Very helpful videos, thank you!!
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);
}
}
I can make my own random number generator! I know this is kid stuff, but I'm so ridiculously happy right now.
doing my part for the algorithm AGAIN while (watching bro code){smash that like button};
Thanks for the help before the test.
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
Nobody:
Random: Curd would book a star had the Oscars seen Additional Mouse Properties.
thx for the knowledge!
string comment = random.nextOpinion();
Sysout(comment, "Java is a girl, so descriptive");
Giga Chad thumbnail in 2020? Very Chad like.
love for helping you beat algorithem.
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;
one of the best class
Superb my Random bro
Nice tutorial you got there :D
Thanks bro great tutorial !
Moment of silence for the poor souls who disliked our Bros Videos. All of you 15,928 ungrateful viewers as well.
1:18 Really Random!
very short and helpful video
Random understood. 8th. Thank you, ma Bro Sensei!
This is the best video I have ever seen
"a random comment"
thx i learnt dfro u again
Your videos are informative and interesting
Best channel ever!
Thank you.
random comment
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.
Drop a pseudo-random comment guys !!!
Boolean
Foolean
Toolean
Coolean
Poolean
Woolean
Thnaks
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");
}
}
Thanks bro!
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
Thank you
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
blue jeans and bloody tears
thank you very much
🔥🔥🔥
int x= random.nextInt(6)+8 what happens then??
You get a random number between 7 and 12
ellerinize sağlık güzel olmuş. kısa ve öz
Very good Video :)
thanks for watching Creeper!
nice one bro
Thanks
Striaght to the point
Thanks bro👍
I love this guy!
@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*
another great one
Great job
Thanks Bro
Thank you bro
thanks
The Random Hypotenuse GUI Form 😁😁😁
import javax.swing.JOptionPane;
import java.util.Random;
public class Main {
public static void main(String[] args) {
Random random = new Random();
int a = random.nextInt(20) + 1;
JOptionPane.showMessageDialog(null, " a : " + a);
int b = random.nextInt(20) + 1;
JOptionPane.showMessageDialog(null, " b : " + b);
double c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
JOptionPane.showMessageDialog(null, "The Hypotenuse is : " + c);
}
}
what name this program so i can download it
ty bro
I like it Picasso
Nice Bro ;)
Great
Guys please how to give that number a percentage for not showing up
I want to play video games, but my father won't let me do it because he thinks that it's Satan's thing
4:20 A random comment
How to generate random numbers between 0 to 1?
how do i take range as an input from user
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
Excellent Bro ☺♥
you are amazing!
this code is very useful for me
👍
Good video
good job
Thank you soooo much !!!
Glad it helped!
thanks, bro
amazing
thx man