Hi everyone, i want to write codes that will input random number to an array(say of size 9),already i have used random method in Math class but i just want to know if there is another method i can use to input random number into an array other than the one mentioned. then how can i put the code if i now want to print out the largest number of this array, cos i wasn't able to find way around it in java API
gyno
-5
Light Poster
Recommended Answers
Jump to Postwhy would you need another way of doing so?
that's a very long sentence, could you please explain a bit more clear?
Jump to Post@gyno, i cannot provide full code but can help you little with following since its against the rule to provide the code.
1) Create an array likeint randomArray[]=new int[10]
.
1) Generate 10 random numbers using for loop &Math.random()
then store it in an array.
2) Use the for …
Jump to PostYou are heading in the right direction. What's missing is that you print your random numbers but you don't store then in the array. There's no method you can just call to do it any better.
There's no ready method to get the largest or smallest number in the array, …
All 11 Replies
stultuske
1,116
Posting Maven
Featured Poster
jalpesh_007
-3
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
gyno
-5
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
vinnitro
12
Newbie Poster
JamesCherrill
commented:
Good advice. Gives direction without spoon-feeding.
+15
gyno
-5
Light Poster
gyno
-5
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
pbj.codez
-3
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.