In class random48 suppose one-parameter next nt invokes


Question: In class Random48, suppose one-parameter next nt invokes zero-parameter nextInt instead of next Long (and cleans up the corner case concerning Math. abs(Integer. MIN_VALUE) ).

a. Show that in that case, if N is very large then some remainders are significantly more likely to occur than others. Consider, for instance N = 230 + 1.

b. Suggest a remedy to the above problem.

c. Does the same situation occur when we invoke nextLong?

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: In class random48 suppose one-parameter next nt invokes
Reference No:- TGS02462268

Now Priced at $10 (50% Discount)

Recommended (96%)

Rated (4.8/5)