Win a copy of Functional Reactive Programming this week in the Other Languages forum!

# Seed Value

Micheal John
Ranch Hand
Posts: 344
From web page

What is the seed value?

Joe Harry
Ranch Hand
Posts: 10124
3
I'd say the answer is d.

Micheal John
Ranch Hand
Posts: 344
But answer is e.None of the above..
And also I want to know what is seed value?

Bin Qian
Greenhorn
Posts: 18
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
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
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
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
@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: 8900
5
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
Barry Gaunt posted December 08, 2006 05:03 AM
@Bu: just go up in the directory and down into this

thanks, found it.
Bu.