Results 1 to 7 of 7
- 11-12-2008, 05:12 AM #1
Member
- Join Date
- Nov 2008
- Posts
- 3
- Rep Power
- 0
- Could anyone type up a simple probability program?
You could create an array of 100 chars and place x 'a' chars in it, y 'b' chars in it, etc... then use the util Random class to randomly select a char and use it.
- 11-12-2008, 05:17 AM #3
Member
- Join Date
- Nov 2008
- Posts
- 3
- Rep Power
- 0
-
Nothing barbarous about it. If it works, use it. If it doesn't don't.
Oh and cross-posting can frustrate anyone who tries to help you only to find out later that the same answer was given hours ago in a cross-posted thread. No one likes wasting their time, especially a volunteer. The polite thing to do would be to not do this, but if you feel that you absolutely must, to at least provide links in both cross-posts to each other.
sun java forums post
- 11-12-2008, 05:21 AM #5
Member
- Join Date
- Nov 2008
- Posts
- 3
- Rep Power
- 0
If anyone can suggest a more efficient way, please let me know!
And thanks, Fubarable. But, I need efficiency. :(
-
Then tell me how is it inefficient? Have you run it through a profiler and found it to have bottlenecks? What are the bottlenecks then? Just what do you suppose is faster than calling a random method followed by a quick lookup in an array?
Last edited by Fubarable; 11-12-2008 at 05:27 AM.
-
Similar Threads
-
the explanation of output of simple java program
By amol84 in forum New To JavaReplies: 1Last Post: 11-06-2008, 05:06 PM -
Not able to debug simple hello world program
By amit123solanki in forum New To JavaReplies: 1Last Post: 06-12-2008, 03:41 PM -
Peculiarty in code of simple program...
By Kreuz14 in forum New To JavaReplies: 4Last Post: 01-23-2008, 03:27 AM -
help with simple program in java
By katie in forum New To JavaReplies: 2Last Post: 08-06-2007, 08:03 PM -
help with simple java program
By leonard in forum New To JavaReplies: 3Last Post: 07-30-2007, 09:40 AM
Bookmarks