github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/math/rand/v2/pcg.go (about)

     1  // Copyright 2023 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 rand
     6  
     7  // PCGは、128ビットの内部状態を持つPCGジェネレータです。
     8  // ゼロのPCGは、NewPCG(0, 0)と同等です。
     9  type PCG struct {
    10  	hi uint64
    11  	lo uint64
    12  }
    13  
    14  // NewPCGは、与えられた値でシードされた新しいPCGを返します。
    15  func NewPCG(seed1, seed2 uint64) *PCG
    16  
    17  // Seedは、PCGをNewPCG(seed1, seed2)と同じように動作するようにリセットします。
    18  func (p *PCG) Seed(seed1, seed2 uint64)
    19  
    20  // MarshalBinaryは、encoding.BinaryMarshalerインターフェースを実装します。
    21  func (p *PCG) MarshalBinary() ([]byte, error)
    22  
    23  // UnmarshalBinaryは、encoding.BinaryUnmarshalerインターフェースを実装します。
    24  func (p *PCG) UnmarshalBinary(data []byte) error
    25  
    26  // Uint64は、一様に分布したランダムなuint64の値を返します。
    27  func (p *PCG) Uint64() uint64