Re: [scala-functional] EXERCISE 6.2: generating a random Double from a random Int

2018-04-10 Thread Ben Hutchison
On Tue, Apr 10, 2018 at 8:24 AM, Adam Mackler wrote: > > Maybe I'm missing something, but it seems to me that since a Double is > represented using 64 bits and an Int 32, that using the amount of > randomness in an Int to generate a random Double will mean that the results > will be unevenly distr

[scala-functional] EXERCISE 6.2: generating a random Double from a random Int

2018-04-10 Thread Adam Mackler
Exercise 6.2 on page 83: *Write a function to generate a Double between 0 and 1 , not including 1.* The given hint and answer indicate generating a non-negative Int and then dividing it by the one more than the maximum possible Int value. Maybe I'm missing something, but it seems to me that si