• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[Ask] java.util.Random Algorithm? "

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all..

i have any question about the java.util.Random class..

example the mehod : nextInt(int n);
which return an integer with range 0 - n

what the algorithm which implemented in the java.util.Random class?..
i want to write down the flowchart for my case study..

Thank's
(Sorry my english isn't too good)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API for java.util.Random gives you some details. Did you check it ?
 
Henry Wong
author
Marshal
Pie
Posts: 21424
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A referemce (book which code is based) is provided in the JavaDocs -- see java.util.Random.

Henry
 
Campbell Ritchie
Sheriff
Pie
Posts: 49823
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leonardo Carreira wrote:. . . the mehod : nextInt(int n);
which return an integer with range 0 - n
No, an int in the range 0 . . . n-1. You can never get n returned.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic