Results 1 to 2 of 2
  1. #1
    subash22 is offline Member
    Join Date
    May 2011
    Rep Power

    Default Random Numbers using threads

    I have a program to create random number on an applet.But my idea is to create a new random number for every second on the applet using threads.

    i have the below code to create a single random number

    Java Code:
    import java.awt.*;
    import java.applet.*;
    import java.util.Random;
    public class Ran extends Applet {
            public void init() {}
    	int x;
          	public void RandomIntNumber() {
    	Random r = new Random();
            public void paint(Graphics g) {

    Any help will be much appreciated.................plzzz
    Last edited by Fubarable; 06-05-2011 at 04:10 PM. Reason: quote tags changed to code tags

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    I would suggest that instead of doing that, use Swing (a JApplet) and a Swing Timer. You can find out more about these in the Oracle Java tutorials.

    Note that the original post was edited and quote tags were changed to code tags to aid readability of the posted code.
    Last edited by Fubarable; 06-05-2011 at 04:11 PM.

Similar Threads

  1. Random numbers
    By zel2zel in forum AWT / Swing
    Replies: 3
    Last Post: 03-09-2011, 07:39 PM
  2. Replies: 8
    Last Post: 04-19-2009, 06:50 PM
  3. Help with random numbers
    By checkmylongboarding in forum New To Java
    Replies: 2
    Last Post: 01-12-2009, 06:47 AM
  4. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 11:44 PM
  5. random numbers
    By carlos123 in forum New To Java
    Replies: 1
    Last Post: 12-22-2007, 03:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts