Descriptionmath/rand: restore Go 1.2 value stream for Float32, Float64
CL 22730043 fixed a bug in these functions: they could
return 1.0 despite documentation saying otherwise.
But the fix changed the values returned in the non-buggy case too,
which might invalidate programs depending on a particular
stream when using rand.Seed(0) or when passing their own
Source to rand.New.
The example test says:
// These tests serve as an example but also make sure we don't change
// the output of the random number generator when given a fixed seed.
so I think there is some justification for thinking we have
promised not to change the values. In any case, there's no point in
changing the values gratuitously: we can easily fix this bug without
changing the values, and so we should.
That CL just changed the test values too, which defeats the
stated purpose, but it was just a comment.
Add an explicit regression test, which might be
a clearer signal next time that we don't want to change
the values.
Fixes issue 6721. (again)
Fixes issue 8013.
Patch Set 1 #Patch Set 2 : diff -r a129b2524679 https://code.google.com/p/go/ #Patch Set 3 : diff -r c431c60edb20 https://code.google.com/p/go/ #Patch Set 4 : diff -r ddf9fa84f55b https://code.google.com/p/go/ #
MessagesTotal messages: 4
|