• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seed Value

 
Micheal John
Ranch Hand
Posts: 344
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From web page


What is the seed value?
 
Joe Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say the answer is d.
 
Micheal John
Ranch Hand
Posts: 344
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But answer is e.None of the above..
And also I want to know what is seed value?
 
Bin Qian
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer is e.
because the random method is a static method.so it cann't be overloaded.and it has no argument, and the returned value is greater or equals to 0 and always less than 1.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question is very simply answered if you look at the Java API for Math.random. There you will see that there is only one double Math.random() method. So you do not even have to know for this question what a seed value is.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course, you can always read Dan's own answers. He put a lot of effort into his questions and explanations, so spend time reading them, you can learn a lot.
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

I could not find the solution page in the link provided from Michael (question #12).

Anyway, a seed is a starting value in generating pseudo random numbers.
If you specify the seed, all "random" numbers generated from this will appear in the same sequence.

But in Math.random() you cannot specify the seed, it is calculated from the system time in milliseconds.

You can however specify the seed in the java.util.Random class.
Example:

The first two columns started with the same seed show the same "random" numbers.
Output is



Seed is used when you want some control in your random numbers, eg when doing statistics or cheating in online poker games. For the last thing be sure your gun is faster, cowboys.


Yours,
Bu.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Bu: just go up in the directory and down into this

As I said before knowing what a seed is to 100% irrelevant to this question. Looking at the Math API is the important thing to learn to do.
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from the wet towel dept.:

This is clearly NOT a SCJP 5 topic and I think it's a little outside the scope of the 1.4 exam too.
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry Gaunt posted December 08, 2006 05:03 AM
@Bu: just go up in the directory and down into this

thanks, found it.
Bu.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic