package crypto

import (
	

	
)

// RandInt64n returns random int64 from randSource in [0; n).
func ( io.Reader,  int64) (int64, error) {
	,  := RandInt64()
	if  != nil {
		return 0, 
	}
	if  < 0 {
		 *= -1
	}
	return  % , nil
}

// RandInt64 returns random int64 from randSource.
func ( io.Reader) (int64, error) {
	var  [bin.Word * 2]byte
	if ,  := io.ReadFull(, [:]);  != nil {
		return 0, 
	}
	 := &bin.Buffer{Buf: [:]}
	return .Long()
}

// RandInt128 generates and returns new random 128-bit integer.
//
// Use crypto/rand.Reader as randSource in production.
func ( io.Reader) (bin.Int128, error) {
	var  [bin.Word * 4]byte
	if ,  := io.ReadFull(, [:]);  != nil {
		return bin.Int128{}, 
	}
	 := &bin.Buffer{Buf: [:]}
	return .Int128()
}

// RandInt256 generates and returns new random 256-bit integer.
//
// Use crypto/rand.Reader as randSource in production.
func ( io.Reader) (bin.Int256, error) {
	var  [bin.Word * 8]byte
	if ,  := io.ReadFull(, [:]);  != nil {
		return bin.Int256{}, 
	}
	 := &bin.Buffer{Buf: [:]}
	return .Int256()
}