// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package rand

import 

// A ChaCha8 is a ChaCha8-based cryptographically strong
// random number generator.
type ChaCha8 struct {
	state chacha8rand.State
}

// NewChaCha8 returns a new ChaCha8 seeded with the given seed.
func ( [32]byte) *ChaCha8 {
	 := new(ChaCha8)
	.state.Init()
	return 
}

// Seed resets the ChaCha8 to behave the same way as NewChaCha8(seed).
func ( *ChaCha8) ( [32]byte) {
	.state.Init()
}

// Uint64 returns a uniformly distributed random uint64 value.
func ( *ChaCha8) () uint64 {
	for {
		,  := .state.Next()
		if  {
			return 
		}
		.state.Refill()
	}
}

// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func ( *ChaCha8) ( []byte) error {
	return chacha8rand.Unmarshal(&.state, )
}

// MarshalBinary implements the encoding.BinaryMarshaler interface.
func ( *ChaCha8) () ([]byte, error) {
	return chacha8rand.Marshal(&.state), nil
}