Current location: Hot Scripts Forums » Programming Languages » Everything Java » java set random weight in instance


java set random weight in instance

Reply
  #1 (permalink)  
Old 08-31-04, 10:21 AM
joebloggs2004 joebloggs2004 is offline
New Member
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Post java set random weight in instance

I need some help with a small problem.

I have a class called GoldenPerch. I want to create an instance (which i know how to do), and then randomly set it's weight using a method called public void setWeight() which uses random() from java.lang.Math. The weight must be between 0.0 and 5.0.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-24-04, 10:37 AM
Rob_Darkins Rob_Darkins is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
see: www.javaalmanac.com and search for "random" to find out how to produce a random number

[r.D]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 08:19 PM


All times are GMT -5. The time now is 01:22 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.