Bucky, thanks for a great tutorial, I am currently on the 26th tutorial video atm, but I have already programmed sort of a beta of Dice Poker. It works :)
why the fuck is eclipse suddenly shooting up from 2% cpu usage to 75% cpu usage when i try and do simple stuff like create and delete clases with nothing in them... and it takes like 10 minuts.... dafuq
Hey Everyone! im a 15 year old teaching myself java from bucky. i watched most and understood most of c++ but im sticking with java. java is easy and fun. i have mad a legit guessing game using the random number generator. i did this all by heart of all the knoledge i know so far from programming. i am releasing the code. Message me for link! to see it Maybe this can help anyone in a way?! im on youtube 24/7!
@VictinaJustev you forgot ===, which tests if the types are the same, for example, 25 === "25" returns false because "25" is a string and 25 is a number. string != number. However, == tests equality on terms of value. "25" == 25 returns true because 25 = 25. using simply = is for assigning something. This is stuff a programmer should just know.
@COD5252 he does 1+ because if you don't the number of the generator will begin at zero and end at the number before what you wrote. if you put +1 you get from 1 to your number.
how can i use an if statement with this. For example in a magic 8ball program. I want to generate a random int then do If int=1 sysout("yes") ect with other numbers. It says cannot convert int to boolean. Help please.
Couldn't you use the Math.random method and then you get something like 0.293847384753847573? Then all you would do is multiply that by 6 and add 1. Then you could use the rounding methods.
Most of the time, views decrease as the video number goes up but I guess as this video teachers you how to build an ACTUAL program the views have gotten higher. Thanks bucky for your java help, they're real easy to understand :DD
Well, yes and no. You would certainly get an extra number, but there'd still be the possibility to roll a "0". The point of adding 1 was to alter the range from "0-5" to "1-6".
How would I make it pick a random string from an array? I have my static variable with an array, but I can't figure out how to make it pick a random thing from the array...
@Everlovingful Depending on the max amount of damage you can do public static void main (String[] args) { Random rand = new Random(); int swings; int randomcounter = rand.nextInt(10000); int dmgdealed = 0; for(swings=1; dmgdealed <=100000; swings++) { dmgdealed += randomcounter; System.out.println(swings); }
That will deal between 0 and 10.000 damage. For the critical chance, etc. is harder, but you will have no problems doing it using this concept.
@imkoreandontmess he laeves a space so that the words look nicer .... for example System.out.println(Hello + " " + Bucky) will print out as "Hello Bucky" Wheras if u do like this..System.out.println(Hello + Bucky).. i will print out as "HelloBucky".. this is why he uses a space between them...
Is JavaScript Math.random method to generate random events truly random or not??? I heard that random systems based on algorithms aren't truly random.....
I'm so bored I made a guessing game that lets you decide the number range you guess in, how many rounds you want to play, and gives a score based on how close you were to the number.
Random numb = new Random(); int x; int dice; x = numb.nextInt(100); System.out.println("This is a Random Number of max. 2 digits: "+x); System.out.println("A dice thrown 8 times:"); for(int count=0; count<8; count++){ dice=numb.nextInt(6); System.out.println(dice+1); } int count=0; System.out.println("\nTake these 2 RNs too:"); while(count<2){ dice=numb.nextInt(100); System.out.println("Now "+ (dice+1)); count++;
{ int bucky[]= new int[10]; int number; Random dice = new Random(); number = dice.nextInt(10); bucky[0]=87; bucky[1]=100; bucky[2]=150; bucky[3]=250; bucky[4]=2050; bucky[5]=142; bucky[6]=234; bucky[7]=141; bucky[8]=241; bucky[9]=2412; System.out.println(bucky[number]);
}
}
This actually selects a random number in the array wich outputs an array chosen by the random engine..
Just create new integer(i called it total), and in for loop, it keeps adding to total that random number, and print it. :) Remember to set total to zero.
............................................
public class apples { public static void main(String args[]){ Random a = new Random(); int number; int total = 0; for(int i=1;i<=10;i++){ number = a.nextInt(6)+1; total = total + number; } System.out.println(total); }
you should take the "ln".
glampkoo 2 days ago
Bucky, thanks for a great tutorial, I am currently on the 26th tutorial video atm, but I have already programmed sort of a beta of Dice Poker. It works :)
I am 100% tuned in!
ottozeimer 6 days ago
why the fuck is eclipse suddenly shooting up from 2% cpu usage to 75% cpu usage when i try and do simple stuff like create and delete clases with nothing in them... and it takes like 10 minuts.... dafuq
dragonthewatcher 6 days ago
Type: sout then press tab its much faster
Roger4313 6 days ago
Hey Everyone! im a 15 year old teaching myself java from bucky. i watched most and understood most of c++ but im sticking with java. java is easy and fun. i have mad a legit guessing game using the random number generator. i did this all by heart of all the knoledge i know so far from programming. i am releasing the code. Message me for link! to see it Maybe this can help anyone in a way?! im on youtube 24/7!
kidharris55 1 week ago
it can't return 0
gustavboll1 1 week ago
@VictinaJustev you forgot ===, which tests if the types are the same, for example, 25 === "25" returns false because "25" is a string and 25 is a number. string != number. However, == tests equality on terms of value. "25" == 25 returns true because 25 = 25. using simply = is for assigning something. This is stuff a programmer should just know.
B1KMusic 2 weeks ago
With the for loop can't you just type "for(i=0;i<10;i++)"? it's a lot easier.
B1KMusic 2 weeks ago
why he uses "number +" everytime for the last few tutorials for output
COD5252 3 weeks ago
@COD5252 he does 1+ because if you don't the number of the generator will begin at zero and end at the number before what you wrote. if you put +1 you get from 1 to your number.
MisterMadPanda 3 weeks ago
Comment removed
xibit1987 3 weeks ago in playlist Java (Beginner) Programming Tutorials
This has been flagged as spam show
@COD5252 Reason for the "blank" was becaus he planned on using print instead of println, thats what i think
xibit1987 3 weeks ago in playlist Java (Beginner) Programming Tutorials
Now You Know how To win At Runescape dice Games (:
somedude491 1 month ago in playlist Java Programming Tutorials 4
how can i use an if statement with this. For example in a magic 8ball program. I want to generate a random int then do If int=1 sysout("yes") ect with other numbers. It says cannot convert int to boolean. Help please.
BGFreerunner 1 month ago
My numbers didn't match yours? Jk
wingnutlord 1 month ago 2
i use syso (control space)
NICKcoolize 1 month ago
Couldn't you use the Math.random method and then you get something like 0.293847384753847573? Then all you would do is multiply that by 6 and add 1. Then you could use the rounding methods.
jrjy3 1 month ago in playlist Java Programming Tutorials
Anyone else going to make a slot machine now?
KristopherSw 1 month ago
how can i ask the user if he would like to play again? y/n nd when he says yes the program runs again help pls. like whats the code for it?
BlackZeroHawk 1 month ago
Most of the time, views decrease as the video number goes up but I guess as this video teachers you how to build an ACTUAL program the views have gotten higher. Thanks bucky for your java help, they're real easy to understand :DD
t4techy 1 month ago
all I get is java.util.Random@586dd8f1
jspspike2 2 months ago
In the last System.out.println(), what do the empty quotation marks do? It works fine without them.
C0GSniper 2 months ago in playlist Java Programming Tutorials
I'm trying to do this, but the numbers have to be unique.. Can't figure it out >=|
MrBuskaroo 2 months ago
@MrBuskaroo What do you mean?
C0GSniper 2 months ago in playlist Java Programming Tutorials
@C0GSniper I mean the values that are returned cannot be duplicates, they all have to be unique, I figured it out anyway.
MrBuskaroo 2 months ago
@MrBuskaroo Out of interest, what did you do?
ybman 1 month ago
@ybman Have you got an e-mail address and I can send you the script? It would be so much easier to show than explain.
MrBuskaroo 1 month ago
can't you just make the random parameter number to 7 instead of 6 if you want an extra number for random generation?
korkypnoy 2 months ago in playlist Java Tutorial Playlist
@korkypnoy
Well, yes and no. You would certainly get an extra number, but there'd still be the possibility to roll a "0". The point of adding 1 was to alter the range from "0-5" to "1-6".
theSketchyCoder 2 months ago
@theSketchyCoder oh ok, yeah I get it now thanks a lot :)
korkypnoy 2 months ago
I'm understanding how fighting games work now.
Alavistaven2012 2 months ago
like 1101010001010101001001?
TalonsFriend 2 months ago
*values
TalonsFriend 2 months ago
Is it possible to get valus between 0 and 1?
TalonsFriend 2 months ago
@TalonsFriend double number = dice.nextint(1);
menthus123 2 months ago in playlist More videos from thenewboston
goddamit I get 2's and 5's all the time to!
HectorFaelisy 2 months ago in playlist Java Programming Tutorials
Why doesnt he show the tuna.java class ?? Bdw nice vids :D
MultiGamerDA 2 months ago
HELP
I managed to get different numbers to you?
What did I do wrong lol jokes
MyBlindRun 2 months ago
You don't even write an algorithm?
jas16899 2 months ago
I wanted 5 numbers... I got 3 1 4 1 5.... PI!
SpidarStar 2 months ago
i got a question. at school we also learned that you can just use:
double dice=Math.random();
then you cont have to import the java.util.Random
is there any difference in this one and the one you used?
NebulaOrbit 3 months ago in playlist Java Programming Tutorials
@NebulaOrbit Essentially no if you loop it so it gives dice a new value each time.
Mlackey94 2 months ago in playlist Java Tutorials
I got 4 8 15 16 23 42 :/ im kinda LOST!
Armaos69 3 months ago 30
@Armaos69 You didn't put 6 in the dice.nextInt.
zVenFTW 2 months ago
@zVenFTW You actually didnt get my comment.. these are the code numbers from Lost series :)
Armaos69 2 months ago
@Armaos69 Actually, you asked something and i answered to it. That's all.
zVenFTW 2 months ago
@zVenFTW i didnt blame you bro.. you did the right thing :) Thnx for your reply :)
Armaos69 2 months ago
@Armaos69 You might have added an extra number in there,
HTMLMINECRAFTGUYJAVA 1 month ago
@Armaos69 Unless you put up the maximum, that wouldn't be possible.
TheExplodingPumpkin 1 month ago
Comment removed
chucky207 4 days ago
@Armaos69 Ok .... (another example of wt he said) :
if we want to find random numbers between 51 and 70 we need to say :
num=51+ obj . nextInt (19) ;
51 -> from where it's starts
19 -> how many number after 51 ( 51+19=70)
chucky207 4 days ago
How would I make it pick a random string from an array? I have my static variable with an array, but I can't figure out how to make it pick a random thing from the array...
PeacedDollar 3 months ago in playlist Java Programming Tutorials
Comment removed
Armaos69 2 months ago
@PeacedDollar i think you should make a random variable to use it as an index for your string array e.g.
Random rand = new Random();
int index = rand.nextInt(Here you put the array's length);
And then you go do whatever you like.. something like:
String randomselection;
randomselection = nameofyourarray[index];
Hope that helps..
Armaos69 2 months ago
@Armaos69 Thanks a lot!
I will see if that works.
PeacedDollar 2 months ago
:P I didn't figure out how to make other things so i made it say # Well your lucky number!
shipmaster4000 3 months ago in playlist Java Programming Tutorials
wow I could make a program that counts the number of swings required to kill a beast with 100K health and I embedded a simple crit chance there=))
Everlovingful 3 months ago
@Everlovingful Depending on the max amount of damage you can do public static void main (String[] args) { Random rand = new Random(); int swings; int randomcounter = rand.nextInt(10000); int dmgdealed = 0; for(swings=1; dmgdealed <=100000; swings++) { dmgdealed += randomcounter; System.out.println(swings); }
That will deal between 0 and 10.000 damage. For the critical chance, etc. is harder, but you will have no problems doing it using this concept.
zVenFTW 2 months ago
if you want to type in "System.out.println();" you can just type "sysout" and press ctl+space. works great and is a lot faster!
kamul8 3 months ago in playlist Bucky's Java Tutorial 38
@kamul8 it is alot faster thanks man!
richieallen1000 3 months ago in playlist TheNewBoston - Java Programming
@kamul8 Thanks! How did you find that out? ^^
GeekyMe97 1 month ago in playlist More videos from thenewboston
@GeekyMe97
by watching a lecture on "Java in Eclipse"
/watch?v=dYwVAi3TPrk
sadly its in german, so if you dont speak it, dont bother watching ;-)
kamul8 1 month ago
@kamul8 Crap >-<
I'm learning German, but far from being able to listen to people talk it .__.'
GeekyMe97 1 month ago
@GeekyMe97
i just discovered that pressing [clr]+[shift]+[L] gives you a list of shortcuts.
have fun!
kamul8 1 month ago
@kamul8
or just "Syso" and ctrl+space, but shortcuts aren't good for beginners.
tonilocoable 1 month ago
@kamul8 thanks :)
Decodeish1 1 month ago in playlist Java Programming Tutorials
@kamul8 you can also write syso and then ctrl + space ;D
Decodeish1 1 month ago in playlist Java Programming Tutorials
i know, but "sys(tem.)out" makes more sense and is easier to memorize
but i use"syso" too ;-)
kamul8 1 month ago
@kamul8 You can just write "Syso" and then press ctrl+space, actually :)
Mtc529 1 month ago
This has been flagged as spam show
@Mtc529
i know, but "sys(tem.)out" makes more sense and is easier to memorize
but i use"syso" too ;-)
kamul8 1 month ago
@kamul8 It's amazing. Thank you a lot! :D
TheExplodingPumpkin 1 month ago
@kamul8 where did you get your shortcuts from?
ToTCaMbIu 4 weeks ago in playlist The New Boston Java Tutorials Bucky
@kamul8 works with syso also
barryt06 2 weeks ago in playlist Java (Beginner) Programming Tutorials
@kamul8 Even faster is syso + CTRL + SPACE
Patrick128000 1 week ago
@Patrick128000
i know, i just wanted to tell people the longer version because it is easier to memorize
but i use syso too...
kamul8 1 week ago
i have always wondered why you leave space between " "
Ex,
System.out.println(Hello + " ");
imkoreandontmess 3 months ago
@imkoreandontmess he laeves a space so that the words look nicer .... for example System.out.println(Hello + " " + Bucky) will print out as "Hello Bucky" Wheras if u do like this..System.out.println(Hello + Bucky).. i will print out as "HelloBucky".. this is why he uses a space between them...
mjdhiru 3 months ago
In the end he almost said "play along with it" but he corrected himself.
Minecrafter797 3 months ago in playlist Java Programming Tutorials
999999999 is the number i used
ooooppps!!!
cowbox101 3 months ago
so usefull
miguelaerosmith29 3 months ago
i started on the tutorials because of minecraft. I stayed because of Bucky!!!
awsmB34r 3 months ago in playlist Java Programming Tutorials
I'm technically as likely to get 5 5 5 5 5 5 5 5 5 5 as I am to get 1 2 3 4 5 6 1 2 3 4 !
TheDiggster13 3 months ago
Is it possible to use the random generator to generate up to negative numbers?
idiotrun1997 3 months ago in playlist Java Programming Tutorials
@idiotrun1997 Yes easily, make an array for negative numbers and count from negative numbers to whatever.
RMCxMODDERSx 3 months ago
Hey, I have a question:
Is JavaScript Math.random method to generate random events truly random or not??? I heard that random systems based on algorithms aren't truly random.....
IceAges14Aces 3 months ago
I made a simple lottery using this
theXminecrafter 3 months ago
Comment removed
theXminecrafter 3 months ago
made a password creator that creates as long passwords as you need and uses all numbers and lower case letters and Upper case letters.
PopulardayOfApril 4 months ago
@PopulardayOfApril
can u post the code plz.?
knight11ind 3 months ago in playlist Java Programming Tutorials
@knight11ind Maybe i can send it or what?
PopulardayOfApril 1 month ago
How considerate of you to add calming bird sounds in the background!
Sobieski1 4 months ago in playlist Java Programming Tutorials
okay im learning math O__O" dang this makes my head hurt T__T
marko4449 4 months ago
or just Math.Random()
JKTCGMV13 4 months ago in playlist More videos from thenewboston
@JKTCGMV13 Math.Random() only gives you a number from 0 through 1.
SprayedToTheBone 4 months ago
Thanks!
vertoxz123 4 months ago
wtf ^^ out aint workin for me ... is it out of memory thing?
PPGaminGProductions 4 months ago
lol dice....
iblowmydad 4 months ago
Dude you generated my phone number at 3:54 ! WTF!
xRobG 4 months ago 3
@xRobG
since a phonenumber always starts with a zero, this isn't yours.
:)
TheWouter101 4 months ago in playlist Java Programming Tutorials
@TheWouter101 My phone number starts with 416, the area code is 1, but you never put area code when dialing locally. So this is my phone number.
xRobG 4 months ago
How do you generate a "double" random with a range (like from 4.6 to 8.3)
amermomani 4 months ago
Just 1 question, why did you type System.out.println(number + " ") ; instead of
System.out.println(number);?
sporreking 5 months ago in playlist java programming from 'the new boston'
@sporreking System.out.println(number + " ") gives a space after the number. It shouldn't matter if you don't put it.
RaqibulHayder 4 months ago
Man, you really should write a book about java... it's easier to study these stuff on books.
EpicnessPivotMaster 5 months ago
Comment removed
madr0ry 4 months ago
Comment removed
madr0ry 4 months ago
You smoke?
sammyzeus 5 months ago in playlist Java Programming Tutorials
i typed:
System.out.println("7,7,7,7,7,7,7.");
and got '7,7,7,7,7,7,7.'!
must be a message
the314Qwerty 5 months ago
This is the first video to hear Bucky opened the window. Check the birds chirp in the background. Must have been a good sunny day...
Later on (sometime in late autumn) check out for the crickets chirr...
Easier to catch with headphones on...
tnagya 5 months ago
sorry I meant number + 1
Jesteria78 5 months ago
you can also say number++ in your println... (yes, that is ugly) :)))
Jesteria78 5 months ago
pretty a cool way to get that :---)
baseball47347 6 months ago
int GetRandomNumber{
return 4;
}
// Perfectly Random.
bizaromatt 6 months ago 5
Huh... I got 7 3s in a row... Neat.
Naihatsu92 6 months ago
I just got 2 5 5 0 2 2 5 0 2 0
ITS A CONSIPRACY!
DarthLOL293 7 months ago 21
@DarthLOL293 this system relies on PC lag oso from what i heard :D
strawberryicedtea 7 months ago
for(int counter=1; counter<=1000;counter++){ number = 50+lol.nextInt(100); if(number <= 100) System.out.println(number);
cheaterhacker1 7 months ago
i prefer using
(random = rar)
int random =rar.nextInt(5)+1
FullOfJavaBeans 7 months ago in playlist thenewboston Java Tutorials
RPG BATTLE SYSTEM :) if(dice + attack >= 5) { System.out.println("You have defeated the monster");
} else { System.out.println("You have lost and you were killed");
}
scrbluegaming 7 months ago
Shit, now I have to find the Video4Winter comment.
preymouth 7 months ago 14
BUCKY FOR PRESIDENT
hizzleyo 7 months ago 3
diyyuce
seed419 8 months ago in playlist Bucky's Java Tutorial
For such a brilliant programmer, I figured you'd know that
clearingYourThroat =/= smokersCough
HarrowedBeThyName 8 months ago in playlist Java Programming Tutorials
thanks dude!!!
izzatnadiri 8 months ago
I'm so bored I made a guessing game that lets you decide the number range you guess in, how many rounds you want to play, and gives a score based on how close you were to the number.
Now to add total score. :)
InvaderWakkoReborn 8 months ago
I used this to generate a random even number from 10-20:
number = (5+dice.nextInt(6))*2;
Not hard, but fun to mess around with. :)
InvaderWakkoReborn 8 months ago
Comment removed
TheTwistertjuh 8 months ago
i have got a bug! my output is not the same! 0_o
bor223 8 months ago
Why the balls wouldn't you teach us how to make a random number within a certain range?
It's an incredibly essential part of a random number generator.
GenericPlaque 8 months ago in playlist thenewboston Java Tutorials
@GenericPlaque
He did teach you:
number = 1 + dice.nextInt(6) gives a random number from 1 to 6.
You can also have: number = 5 + dice.nextInt(6). This gives you a random number from 5 to 10.
fopple13 7 months ago
@fopple13
There's a built-in function to do this in Java, and it's much easier to use. :/
GenericPlaque 7 months ago
thx!
im programming a class that can store an Integer in a way that you cant use a memory editor to cheat.
im using a system with random numbers.
plutgamer 9 months ago
Cool, no seeding numbers :)
joannis11 9 months ago
how to use a number generator
y = start posting lots of random shit.
x = put thing like "y =," and "x =,"
use this code :
.
emmetgb 9 months ago
This has been flagged as spam show
Hey everyone, check out my channel for some pretty AWESOME Tutorials, more coming very very soon
RandomTuTV1ds 9 months ago
This has been flagged as spam show
/*TRY THIS*/
Random numb = new Random(); int x; int dice; x = numb.nextInt(100); System.out.println("This is a Random Number of max. 2 digits: "+x); System.out.println("A dice thrown 8 times:"); for(int count=0; count<8; count++){ dice=numb.nextInt(6); System.out.println(dice+1); } int count=0; System.out.println("\nTake these 2 RNs too:"); while(count<2){ dice=numb.nextInt(100); System.out.println("Now "+ (dice+1)); count++;
sharathdozen 10 months ago
Do you do these tutorials while the weather is nice outside? Because I do hear birds singing in the background ; )
nutelina 10 months ago 2
For some I reason, I find it funny that Bucky keeps promising us we're gonna become experts. He should totally put that on a shirt and sell it.
"You'll Be an Expert. I Promise."
unabomberman 10 months ago 3
@unabomberman I think I would buy it :P
joannis11 9 months ago
Don't smoke Bucky! We need your to keep making programming tutorials!
ThePenguinio 10 months ago
@ThePenguinio Like you're reading my mind, even while you are in the past...
joannis11 9 months ago
Comment removed
joannis11 9 months ago
import java.util.Random;
public class apples {
public static void main (String[] args)
{ int bucky[]= new int[10]; int number; Random dice = new Random(); number = dice.nextInt(10); bucky[0]=87; bucky[1]=100; bucky[2]=150; bucky[3]=250; bucky[4]=2050; bucky[5]=142; bucky[6]=234; bucky[7]=141; bucky[8]=241; bucky[9]=2412; System.out.println(bucky[number]);
}
}
This actually selects a random number in the array wich outputs an array chosen by the random engine..
xo
smoothy023 10 months ago
meow
imodatlife 10 months ago
if you got "save problme
with reson "cp1255
You have a wired letter dot thats up
remove it,than the cp letter will remove
PacketEditV75 10 months ago
i used the same coding as you but it gives me a fatal error O.o
b4llscr4tchm0d3 10 months ago
how can i count multiple random numbers together?
krechlich 11 months ago
This has been flagged as spam show
@krechlich
Just create new integer(i called it total), and in for loop, it keeps adding to total that random number, and print it. :) Remember to set total to zero.
............................................
public class apples { public static void main(String args[]){ Random a = new Random(); int number; int total = 0; for(int i=1;i<=10;i++){ number = a.nextInt(6)+1; total = total + number; } System.out.println(total); }
}
Djolezloba 10 months ago
Like tutorial VM >.<
Question:
what does mean this writing: SMT = random(int, int); ?
How toexplain two integer numbers in brackets?
Many thanks!
Alek5andr 11 months ago
Bucky, Thanks for sharing :-)
ShakespearHD 11 months ago
another example;
for (int i=0;i<10;i++){
System.out.println(Math.rint(Math.random()*6));
}
TheMoronKiller 11 months ago
its not outputting multiple numbers for me, only one number.
trelagato23 11 months ago
@trelagato23 do you have a loop?
Budishaa 11 months ago
i love the birds in the background, and the relaxing sounds. (lol) nice touch! lawl
MrBlockersPro 11 months ago
I learned to use
int random = x * (int)(Math.random()*y) + z;
x = difference between each number in the set
y = how many numbers in the list to generate from
z = the lowest number possible to be generated
For example
int random = 4 * (int)(Math.random() * 5) + 6;
generates a number from {6, 10, 14, 18, 22}
kevinhc628 1 year ago 35
@kevinhc628 Thank you for this. One question: Why do you have (int) before Math.random?
I'm still pretty new to Java and have not seen that before.
GohansRiceBall 8 months ago in playlist Java Tutorials
@kevinhc628 I figured it out. It's for casting since Math.random(); usually returns a double. Thanks for your comment again.
GohansRiceBall 8 months ago
i got different random numbers :P
kylemaster38 1 year ago
you could also be number = dice.nextInt(6)+1;
raibreakz 1 year ago
@raibreakz
sigh
Moe1993x 1 year ago
Thanks for the simplicity.
adanaz9 1 year ago
import java.util.Random;
class Random_dice { public static void main(String args[]){ Random dice = new Random(); int number; for(int counter = 1; counter<=10; counter++){ number = 10+dice.nextInt(2); System.out.println("Bucky's Java tutorials score: " + number + " / 10"); } }
}
ben1996123 1 year ago
Спасибо большое! Очень помогло.
ydantezs 1 year ago
What's the point of the quotes below?
System.out.println(number+ " ")
wallycall 1 year ago
@wallycall Nothing, just a mistake.
carelessmorning 1 year ago
int lol = Math.ceil(Math.random*10);
Wouldn't that be easier? No need to import stuff and it gives You a random number between 1 and 10.
MCPiciek 1 year ago
@MCPiciek He wanted 1 through 6 to simulate a dice.
j3s0n 1 year ago
@j3s0n I realized that after posting but I'm pretty sure I've seen somewhere someone using this method for numbers between 1 and 6.
MCPiciek 1 year ago
@MCPiciek You might be able to. I can think of an algorithm that may work to limit the results to 1 and 6 with your method.
j3s0n 1 year ago
This has been flagged as spam show
Cool guys Latin ladies here ** rockmycity.info **
RhdajWdjjkk 1 year ago
This has been flagged as spam show
online Latino women dating site here rockmycity.info
vishakarethiva 1 year ago
Comment removed
TheGreekSkater 1 year ago