func (r *Runner) Uint64() uint64 {
	var u Uint64Gen
	r.Draw(&u)
	return uint64(u)
}
Uint64 is a convenience function that returns
a uint64 value from the Runner.
package suss
import (
	"encoding/binary"
	"math"
	"math/rand"
)
type SliceGen struct {
	Avg int
	Min int
	Max int
	f func()
}
type Generator interface {
	Fill(d Data)
}
type Data interface {
	Draw(n int, smp Sample) []byte
	StartExample()
	EndExample()
}
func Slice(f func()) *SliceGen {
	return &SliceGen{
		Avg: 50,
		Min: 0,
		Max: int(^uint(0) >> 1),
		f:   f,
	}
}
func (s *SliceGen) Fill(d Data) {
	l := uint64(0)
	stopvalue := 1 - (1.0 / (1 + float64(s.Avg)))
	if s.Min < 0 {
		panic("invalid min slice length")
	}
	min := uint64(s.Min)
	max := uint64(s.Max)
	for l < max {
		d.StartExample()
		more := biasBool(d, stopvalue)
		if !more && l >= min {
			d.EndExample()
			return
		}
		l++
		sliceCall(s.f, d)
	}
}
func sliceCall(f func(), d Data) {
	defer d.EndExample()
	f()
}
type BoolGen bool
func (b *BoolGen) Fill(d Data) {
	byt := d.Draw(1, Uniform)
	*b = byt[0]&1 == 1
}
func (r *Runner) Bool() bool {
	var bgen BoolGen
	r.Draw(&bgen)
	return bool(bgen)
}
func (r *Runner) Float64() float64 {
	var f Float64Gen
	r.Draw(&f)
	return float64(f)
}
type Float64Gen float64
var nastyFloats = []float64{
	0.0, 0.5, 1.0 / 3, 10e6, 10e-6, 1.175494351e-38, 2.2250738585072014e-308,
	1.7976931348623157e+308, 3.402823466e+38, 9007199254740992, 1 - 10e-6,
	2 + 10e-6, 1.192092896e-07, 2.2204460492503131e-016,
}
func init() {
	n := []float64{math.NaN(), math.Inf(0)}
	for i := 0; i < 5; i++ {
		nastyFloats = append(nastyFloats, n...)
	}
	for _, f := range nastyFloats {
		nastyFloats = append(nastyFloats, -f)
	}
}
func (f *Float64Gen) Fill(d Data) {
	fbits := d.Draw(10, func(r *rand.Rand, n int) []byte {
		if n != 10 {
			panic("bad float size")
		}
		flavor := r.Intn(10)
		var f float64
		switch {
		case flavor <= 4:
			f = nastyFloats[r.Intn(len(nastyFloats))]
		case flavor == 5:
			var b [10]byte
			r.Read(b[:])
			return b[:]
		case flavor == 6:
			f = r.Float64() * float64((r.Intn(2)*2)-1)
		case flavor == 7:
			f = r.NormFloat64()
		case flavor == 8:
			u := r.Int63()
			if r.Intn(2) == 1 {
				u = -u
			}
			f = float64(u)
		default:
			u := r.Int63()
			if r.Intn(2) == 1 {
				u = -u
			}
			f = float64(u)
			n := r.NormFloat64()
			n += f
		}
		b := encodefloat64(f)
		return b[:]
	})
	fl, invalid := decodefloat64(fbits)
	if invalid {
		Invalid()
	}
	*f = Float64Gen(fl)
}
func encodefloat64(f float64) [10]byte {
	var b [10]byte
	bits := math.Float64bits(f)
	b[0] = byte((bits & (1 << 63)) >> 63)
	mant := bits & (^uint64(0) >> (64 - 52))
	binary.LittleEndian.PutUint64(b[1:], mant)
	sexp := int16((bits >> 52) & 0x7ff)
	var exp uint16
	if sexp == 0 {
		if mant != 0 {
			exp = sint16tolex16(-1024)
		}
	} else if sexp == 0x7ff {
		exp = sint16tolex16(-1025)
	} else {
		sexp -= 1023
		if sexp >= 0 {
			exp = uint16(sexp) + 1
		} else {
			exp = sint16tolex16(sexp)
		}
	}
	binary.BigEndian.PutUint16(b[8:], exp)
	return b
}
func sint16tolex16(s int16) uint16 {
	s *= -1
	exp := uint16(s)
	exp ^= (1 << 15)
	return exp
}
func decodefloat64(b []byte) (float64, bool) {
	fbits := uint64(0)
	sign := b[0]
	if sign != 0 && sign != 1 {
		return 0, true
	}
	fbits = uint64(sign) << 63
	var mb [8]byte
	copy(mb[:], b[1:8])
	mant := binary.LittleEndian.Uint64(mb[:])
	exp := binary.BigEndian.Uint16(b[8:])
	if exp&(1<<15) != 0 {
		sexp := int16(exp & (^uint16(0) >> 1))
		if sexp == 1024 {
			exp = 0
		} else if sexp == 1025 {
			exp = 0x7ff
		} else {
			sexp *= -1
			sexp += 1023
			exp = uint16(sexp)
		}
	} else if exp != 0 {
		exp -= 1
		exp += 1023
	} else if mant != 0 {
		mant = 0
	}
	fbits ^= mant & (^uint64(0) >> (64 - 52))
	fbits ^= uint64(exp) << 52
	return math.Float64frombits(fbits), false
}
type Uint64Gen uint64
func (u *Uint64Gen) Fill(d Data) {
	b := d.Draw(8, Uniform)
	*u = Uint64Gen(binary.BigEndian.Uint64(b))
}