// unaryOpRand returns an evenly distributed random value between in and zero.
425051
func unaryOpRand(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpRand, numOutputs, in)
}
168494
func (u *Ugen) Rand() Input {
	return unaryOpRand(u.Rate, u, u.NumOutputs)
}
795604
func (u *Ugen) Sum3rand() Input {
	return unaryOpSum3rand(u.Rate, u, u.NumOutputs)
}
158011
func unaryOpSquared(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpSquared, numOutputs, in)
}
880584
func unaryOpSum3rand(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpSum3rand, numOutputs, in)
}
1116590
func (as ArraySpec) Linrand() Input {
	return as.proc(func(i Input) Input {
		return i.Linrand()
	})
}
384032
func RandomUID() (*UID, error) {
	uidbytes := make([]byte, 16)
	n, err := rand.Read(uidbytes[:])
	if err != nil {
		return nil, err
	}
	if n != 16 {
		return nil, errors.New("RandomUID failed to read 16 random bytes")
	}
	uid := UID(fmt.Sprintf("%08x-%04x-%04x-%04x-%012x", uidbytes[:4], uidbytes[4:6], uidbytes[6:8], uidbytes[8:10], uidbytes[10:]))
	return &uid, nil
}
1074311
func unaryOpAsin(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpAsin, numOutputs, in)
}
583816
func (as ArraySpec) Bilinrand() Input {
	return as.proc(func(i Input) Input {
		return i.Bilinrand()
	})
}
1020573
func (d *digest) unalignedAbsorb(p []byte) {
	var t uint64
	for i := len(p) - 1; i >= 0; i-- {
		t <<= 8
		t |= uint64(p[i])
	}
	offset := (d.absorbed) % d.rate()
	t <<= 8 * uint(offset%laneSize)
	d.a[offset/laneSize] ^= t
	d.absorbed += len(p)
}
827437
func (beng BernoulliGenerator) Bernoulli_P(p float64) bool {
	if !(0.0 <= p && p <= 1.0) {
		panic(fmt.Sprintf("Invalid probability: %.2f", p))
	}
	return beng.uniform.Float64() < p
}
386716
func (enc *Encoding) Random(n int) (string, error) {
	buf := make([]byte, n)
	_, err := rand.Reader.Read(buf)
	if err != nil {
		return "", err
	}
	return enc.EncodeToString(buf), nil
}
1226059
func RandomPolynomial(seed int64) (Pol, error) {
	return DerivePolynomial(rand.New(rand.NewSource(seed)))
}
381375
func unaryOpAbs(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpAbs, numOutputs, in)
}
684919
func unaryOpSin(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpSin, numOutputs, in)
}
235563
func nextRand(seed int64) func(int) int {
	r := rand.New(rand.NewSource(seed))

	return func(numPeers int) int {
		if numPeers == 0 {
			return 0
		}
		return r.Intn(numPeers)
	}
}
108211
func NewUnaryExpr(op string, expr Expr, pos Pos) *UnaryExpr {
	return &UnaryExpr{pos, op, expr}
}