Thread: math.random lenght for int[][]? how to do it?

Results 1 to 2 of 2
  1. #1 math.random lenght for int[][]? how to do it? 
    Registered Member
    minutes's Avatar
    Join Date
    Apr 2008
    Posts
    1,926
    Thanks given
    2
    Thanks received
    19
    Rep Power
    465
    title say all..

    Code:
    	int[][] farmer = {
    		/**item id, lowest amo, random amo, chance**/
    				{995, 500, 2520, 0}, /**money**/
    				{555, 500, 2520, 0}, /**Water Rune**/
    				{560, 500, 2520, 0} /**Death Rune**/
    					};
    its do not work like this
    Code:
    	int RandomFarmer() {
    		return farmer[(int)(Math.random()*farmer.length)][];
    	}
    [Only registered and activated users can see links. ]
    click banner to join gtracer!
    Reply With Quote  
     

  2. #2  
    Hi.

    'Mystic Flow's Avatar
    Join Date
    Nov 2007
    Posts
    7,141
    Thanks given
    256
    Thanks received
    1,247
    Rep Power
    3636
    int lol(){
    int r=(int)(Math.random()*farmer.length);
    int l=(int)(Math.random()*farmer[r].length);
    return farmer[r][l];
    }

    [Only registered and activated users can see links. ]

    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

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