English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2007-11-29 14:58:36 · 4 answers · asked by jasonhed@pacbell.net 1 in Computers & Internet Programming & Design

Thank you for your response but im looking to see actually how the random number is generated. Basicly the inner workings of somehting like Math.random or any other basic random number generator?

2007-11-29 15:05:47 · update #1

4 answers

As you may, or may not, know, the source code of java is available. It's in the JDK. If u can't find it, send me a mail (via my profile page) with your email address & i ll send it to you (the code is too long to post here).

2007-11-30 02:02:18 · answer #1 · answered by Ben X 2 · 0 0

Math.random() generate a random floating element huge type from 0 - one million. 5-20 has a kind of 15 huge type so first you should scale your selection from 0-one million to 0-15 Math.random() * 15 <== this scale the diversity to 0-15 And to start with 5-20 you should characteristic 5 so ultimately you have Math.random()*15+5

2016-12-30 06:50:48 · answer #2 · answered by ? 4 · 0 0

Check this link.
There is a book reference in the description with more information.

2007-11-29 22:39:44 · answer #3 · answered by AnalProgrammer 7 · 0 0

(int)(Math.random()*(the maximum range of numbers)+(the starting number)

2007-11-29 15:02:24 · answer #4 · answered by Richard Boolean 2 · 0 0

fedest.com, questions and answers