func NewTokenBucket(
	rateHz float64,
	capacity uint64) (tb TokenBucket) {
	tb = &tokenBucket{
		rateHz:   rateHz,
		capacity: capacity,

		creditTime: 0,
		credit:     float64(capacity),
	}

	return
}
func NewTokenBucket(
	rateHz float64,
	capacity uint64) (tb TokenBucket) {
	tb = &tokenBucket{
		rateHz:   rateHz,
		capacity: capacity,

		creditTime: 0,
		credit:     float64(capacity),
	}

	return
}
// Create a token bucket that fills at the given rate in tokens per second, up
// to the given capacity. ChooseTokenBucketCapacity may help you decide on a
// capacity.
//
// The token bucket starts full at time zero. If you would like it to start
// empty, call tb.Remove(0, capacity).
//
// REQUIRES: rateHz > 0
// REQUIRES: capacity > 0