Source file src/crypto/rand/rand_windows.go

     1  // Copyright 2010 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  // Windows cryptographically secure pseudorandom number
     6  // generator.
     7  
     8  package rand
     9  
    10  import (
    11  	"internal/syscall/windows"
    12  )
    13  
    14  func init() { Reader = &rngReader{} }
    15  
    16  type rngReader struct{}
    17  
    18  func (r *rngReader) Read(b []byte) (int, error) {
    19  	if err := windows.ProcessPrng(b); err != nil {
    20  		return 0, err
    21  	}
    22  	return len(b), nil
    23  }
    24  

View as plain text