Added: 2 years ago
From: thenewboston
Views: 141,636
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (284)

Sign In or Sign Up now to post a comment!
  • you should take the "ln".

  • 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!

  • 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

  • Type: sout then press tab its much faster

  • 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!

  • it can't return 0

  • @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.

  • With the for loop can't you just type "for(i=0;i<10;i++)"? it's a lot easier.

  • why he uses "number +" everytime for the last few tutorials for output

  • @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.

  • Comment removed

  • Now You Know how To win At Runescape dice Games (:

  • 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.

  • My numbers didn't match yours? Jk

  • i use syso (control space)

  • 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.

  • Anyone else going to make a slot machine now?

  • 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?

  • 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

  • all I get is  java.util.Random@586dd8f1

  • In the last System.out.println(), what do the empty quotation marks do? It works fine without them.

  • I'm trying to do this, but the numbers have to be unique.. Can't figure it out >=|

  • @MrBuskaroo What do you mean?

  • @C0GSniper I mean the values that are returned cannot be duplicates, they all have to be unique, I figured it out anyway.

  • @MrBuskaroo Out of interest, what did you do?

  • @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.

  • can't you just make the random parameter number to 7 instead of 6 if you want an extra number for random generation?

  • @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 oh ok, yeah I get it now thanks a lot :)

  • I'm understanding how fighting games work now.

  • like 1101010001010101001001?

  • *values

    

  • Is it possible to get valus between 0 and 1?

  • @TalonsFriend double number = dice.nextint(1);

  • goddamit I get 2's and 5's all the time to!

  • Why doesnt he show the tuna.java class ?? Bdw nice vids :D

  • HELP

    I managed to get different numbers to you?

    What did I do wrong lol jokes

  • You don't even write an algorithm?

  • I wanted 5 numbers... I got 3 1 4 1 5.... PI!

  • 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 Essentially no if you loop it so it gives dice a new value each time.

  • I got 4 8 15 16 23 42 :/ im kinda LOST!

  • @Armaos69 You didn't put 6 in the dice.nextInt.

  • @zVenFTW You actually didnt get my comment.. these are the code numbers from Lost series :)

  • @Armaos69 Actually, you asked something and i answered to it. That's all.

  • @zVenFTW i didnt blame you bro.. you did the right thing :) Thnx for your reply :)

  • @Armaos69 You might have added an extra number in there,

  • @Armaos69 Unless you put up the maximum, that wouldn't be possible.

  • Comment removed

  • @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)

  • 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...

  • Comment removed

  • @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 Thanks a lot!

    I will see if that works.

  • :P I didn't figure out how to make other things so i made it say # Well your lucky number!

    

  • 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 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.

  • 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 it is alot faster thanks man!

  • @kamul8 Thanks! How did you find that out? ^^

  • @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 Crap >-<

    I'm learning German, but far from being able to listen to people talk it .__.'

  • @GeekyMe97

    i just discovered that pressing [clr]+[shift]+[L] gives you a list of shortcuts.

    have fun!

  • @kamul8

    or just "Syso" and ctrl+space, but shortcuts aren't good for beginners.

  • @kamul8 thanks :)

  • @kamul8 you can also write syso and then ctrl + space ;D

  • i know, but "sys(tem.)out" makes more sense and is easier to memorize

    but i use"syso" too ;-)

  • @kamul8 You can just write "Syso" and then press ctrl+space, actually :)

  • @kamul8 It's amazing. Thank you a lot! :D

  • @kamul8 where did you get your shortcuts from?

  • @kamul8 works with syso also

  • @kamul8 Even faster is syso + CTRL + SPACE

  • @Patrick128000

    i know, i just wanted to tell people the longer version because it is easier to memorize

    but i use syso too...

  • i have always wondered why you leave space between " "

    Ex,

    System.out.println(Hello + " ");

  • @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...

  • In the end he almost said "play along with it" but he corrected himself.

  • 999999999 is the number i used

    ooooppps!!!

  • so usefull

  • i started on the tutorials because of minecraft. I stayed because of Bucky!!!

  • 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 !

  • Is it possible to use the random generator to generate up to negative numbers?

  • @idiotrun1997 Yes easily, make an array for negative numbers and count from negative numbers to whatever.

  • 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.....

  • I made a simple lottery using this

  • Comment removed

  • 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

    can u post the code plz.?

  • @knight11ind Maybe i can send it or what?

  • How considerate of you to add calming bird sounds in the background!

  • okay im learning math O__O" dang this makes my head hurt T__T

  • or just Math.Random()

  • @JKTCGMV13 Math.Random() only gives you a number from 0 through 1.

  • Thanks!

  • wtf ^^ out aint workin for me ... is it out of memory thing?

  • lol dice....

  • Dude you generated my phone number at 3:54 ! WTF!

  • @xRobG

    since a phonenumber always starts with a zero, this isn't yours.

    :)

  • @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.

  • How do you generate a "double" random with a range (like from 4.6 to 8.3)

  • Just 1 question, why did you type System.out.println(number + " ") ; instead of

    System.out.println(number);?

  • @sporreking System.out.println(number + " ") gives a space after the number. It shouldn't matter if you don't put it.

  • Man, you really should write a book about java... it's easier to study these stuff on books.

  • Comment removed

  • You smoke?

    

  • 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

  • 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...

  • sorry I meant number + 1

  • you can also say number++ in your println... (yes, that is ugly) :)))

  • pretty a cool way to get that :---)

  • int GetRandomNumber{

    return 4;

    }

    // Perfectly Random.

  • Huh... I got 7 3s in a row... Neat.

  • I just got 2 5 5 0 2 2 5 0 2 0

    ITS A CONSIPRACY!

  • @DarthLOL293 this system relies on PC lag oso from what i heard :D

  • for(int counter=1; counter<=1000;counter++){ number = 50+lol.nextInt(100); if(number <= 100) System.out.println(number);

  • i prefer using

    (random = rar)

    int random =rar.nextInt(5)+1

  • 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");

    }

  • Shit, now I have to find the Video4Winter comment.

  • BUCKY FOR PRESIDENT

  • diyyuce

  • For such a brilliant programmer, I figured you'd know that

    clearingYourThroat =/= smokersCough

  • thanks dude!!!

  • 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. :)

  • 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. :)

  • Comment removed

  • i have got a bug! my output is not the same! 0_o

  • 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

    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

    There's a built-in function to do this in Java, and it's much easier to use. :/

  • 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.

  • Cool, no seeding numbers :)

  • how to use a number generator

    y = start posting lots of random shit.

    x = put thing like "y =," and "x =,"

    use this code :

    .

  • Do you do these tutorials while the weather is nice outside? Because I do hear birds singing in the background ; )

  • 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 I think I would buy it :P

  • Don't smoke Bucky! We need your to keep making programming tutorials!

  • @ThePenguinio Like you're reading my mind, even while you are in the past...

  • 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[numbe­r]);

    }

    }

    This actually selects a random number in the array wich outputs an array chosen by the random engine..

    xo

  • meow

  • if you got "save problme

    with reson "cp1255

    You have a wired letter dot thats up

    remove it,than the cp letter will remove

  • i used the same coding as you but it gives me a fatal error O.o

  • how can i count multiple random numbers together?

  • Like tutorial VM >.<

    Question:

    what does mean this writing: SMT = random(int, int); ?

    How toexplain two integer numbers in brackets?

    Many thanks!

  • Bucky, Thanks for sharing :-)

  • another example;

    for (int i=0;i<10;i++){

     System.out.println(Math.rint(M­ath.random()*6));

    }

  • its not outputting multiple numbers for me, only one number.

  • @trelagato23 do you have a loop?

  • i love the birds in the background, and the relaxing sounds. (lol) nice touch! lawl

  • 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 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.

  • @kevinhc628 I figured it out. It's for casting since Math.random(); usually returns a double. Thanks for your comment again.

  • i got different random numbers :P

  • you could also be number = dice.nextInt(6)+1;

  • @raibreakz

    sigh

  • Thanks for the simplicity.

  • 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"); } }

    }

  • Спасибо большое! Очень помогло.

  • What's the point of the quotes below?

    System.out.println(number+ " ")

  • @wallycall Nothing, just a mistake.

  • 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 He wanted 1 through 6 to simulate a dice.

  • @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 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.

  • Comment removed