@@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 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'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 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
import java.util.Random; class Main { public static void main(String[] args) { Random random = new Random(); int x = random.nextInt(3); double y = random.nextDouble(); boolean z = random.nextBoolean(); System.out.println(x); System.out.println(y); System.out.println(z); } }
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();
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"); } }
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
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!
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
I'm so glad I found you! Straight to the point and well explained. Thank you so much!
Me le coding:
Random rand = new Random();
String s = rand.nextString();
RUclips.out.comment(s);
RUclips: Channel recommendation improved...
Me: Wow it worked... 😍🙏
These videos are super helpful for self taught beginner!
I love you classes bro, it really helps
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!
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 🙏
thx for vids !
The random double numbers have various usages for example statistics , probability etc.
Ty
I suppose we can use it even in gaming, like Pack Luck in FIFA for instance
"Random random, equals new random. That's random."
I agree. Thats random.
Now I know how random number generation works for different data types. Thanks.
This is GOOD !!! Variety of JAVA courses.
Finally answers without a need to read 10 pages manual.
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 "
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);
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 :).
4:20 A random comment
This Randomness of the Universe really is helping me
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
3:40 made me lol
Very helpful videos, thank you!!
thank god for these channels dude... even tho im a atheist ! this video has 4 minutes but explains a lot !
I can make my own random number generator! I know this is kid stuff, but I'm so ridiculously happy right now.
Hi Juli can we be friends because I want to learn speak english
Nobody:
Random: Curd would book a star had the Oscars seen Additional Mouse Properties.
Giga Chad thumbnail in 2020? Very Chad like.
import java.util.Random;
class Main {
public static void main(String[] args) {
Random random = new Random();
int x = random.nextInt(3);
double y = random.nextDouble();
boolean z = random.nextBoolean();
System.out.println(x);
System.out.println(y);
System.out.println(z);
}
}
Superb my Random bro
love for helping you beat algorithem.
Your videos are informative and interesting
Thanks for the help before the test.
thank you for great lesson
"a random comment"
Nice tutorial you got there :D
This is the best video I have ever seen
decided to make it do 100, got a 69 on my 3rd roll. Worth it
sigma grindset
very short and helpful video
Random understood. 8th. Thank you, ma Bro Sensei!
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;
thx for the knowledge!
one of the best class
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.
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.
Love these! New binge inc
Good explanation
int x= random.nextInt(6)+8 what happens then??
You get a random number between 7 and 12
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 want to play video games, but my father won't let me do it because he thinks that it's Satan's thing
string comment = random.nextOpinion();
Sysout(comment, "Java is a girl, so descriptive");
thx i learnt dfro u again
Best channel ever!
Striaght to the point
Thanks bro👍
doing my part for the algorithm AGAIN while (watching bro code){smash that like button};
1:18 Really Random!
blue jeans and bloody tears
Excellent Bro ☺♥
ellerinize sağlık güzel olmuş. kısa ve öz
@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*
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
Boolean
Foolean
Toolean
Coolean
Poolean
Woolean
🔥🔥🔥
Very good Video :)
thanks for watching Creeper!
I love this guy!
nice one bro
Thanks bro!
what name this program so i can download it
Guys please how to give that number a percentage for not showing up
how do i take range as an input from user
Thank you soooo much !!!
Glad it helped!
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
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");
}
}
Good Work Bruh!!
Arigato!!
hi, bro!
Hello
thank u soo much u help me lot
thank you very much
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.
Drop a pseudo-random comment guys !!!
Cool!
you are amazing!
Great job
another great one
this code is very useful for me
Nice Bro ;)
How to generate random numbers between 0 to 1?
NOICE
Thnaks
Thank you bro
great
You are the best! I am italian if you want i'll take you pizza hahah.
Hi
Thank you