Top Posters
Since Sunday
a
5
k
5
c
5
B
5
l
5
C
4
s
4
a
4
t
4
i
4
r
4
r
4
New Topic  
Famwam Famwam
wrote...
Posts: 456
3 years ago
(int)(Math.random() * (65535 + 1)) returns a random number ________.

▸ between 1 and 65535

▸ between 0 and 65535

▸ between 0 and 65536

▸ between 1 and 65536
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 390 times
3 Replies
Replies
Answer verified by a subject expert
ccnastopoulosccnastopoulos
wrote...
Posts: 359
3 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here

Related Topics

wrote...
A year ago
WHY B?
wrote...
A year ago
WHY B?

The problem uses Math.random(). That method returns a value between 0 (inclusive) and 1 (exclusive) so that means the value can be 0, and get very close to 1 but will not be 1. So using that, we can get 0, and we will be up to but not equal to 65536, meaning 0 - 65535

Does that make sense?
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  910 People Browsing
Related Images
  
 140
  
 303
  
 222
Your Opinion