github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/crypto/internal/randutil/randutil.go (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package randutil contains internal randomness utilities for various
     6  // crypto packages.
     7  package randutil
     8  
     9  import (
    10  	"github.com/shogo82148/std/io"
    11  )
    12  
    13  // MaybeReadByte reads a single byte from r with ~50% probability. This is used
    14  // to ensure that callers do not depend on non-guaranteed behaviour, e.g.
    15  // assuming that rsa.GenerateKey is deterministic w.r.t. a given random stream.
    16  //
    17  // This does not affect tests that pass a stream of fixed bytes as the random
    18  // source (e.g. a zeroReader).
    19  func MaybeReadByte(r io.Reader)