Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: Famwam on May 5, 2020



Title: (int)(Math.random() * (65535 + 1)) returns a random number ________.
Post by: Famwam on May 5, 2020
(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


Title: (int)(Math.random() * (65535 + 1)) returns a random number ________.
Post by: ccnastopoulos on May 5, 2020
Content hidden


Title: Re: (int)(Math.random() * (65535 + 1)) returns a random number ________.
Post by: eaRSD on Jun 24, 2022
WHY B?


Title: Re: (int)(Math.random() * (65535 + 1)) returns a random number ________.
Post by: TuTTz on Jun 24, 2022
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?