Use the batched reader to chunk large Read calls on windows to a max of
1 << 31 - 1 bytes. This prevents an infinite loop when trying to read
more than 1 << 32 -1 bytes, due to how RtlGenRandom works.
This change moves the batched function from rand_unix.go to rand.go,
since it is now needed for both windows and unix implementations.
Run-TryBot: Roland Shoemaker <firstname.lastname@example.org>
Reviewed-by: Filippo Valsorda <email@example.com>
Reviewed-by: Filippo Valsorda <firstname.lastname@example.org>
TryBot-Result: Gopher Robot <email@example.com>
(cherry picked from commit bb1f441)
Reviewed-by: Damien Neil <firstname.lastname@example.org>