func (multiStore *MultiAddrStore) RandomBootstrapAddrs(n int) ([]wire.Address, error) {
	if n > len(multiStore.bootstrapAddrs) {
		n = len(multiStore.bootstrapAddrs)
	}
	indexes := rand.Perm(n)
	addrs := make([]wire.Address, 0, n)
	for _, index := range indexes {
		addrs = append(addrs, multiStore.bootstrapAddrs[index])
	}
	return addrs, nil
}
RandomBootstrapAddrs returns a random number of Bootstrap multi-addresses in
the store.
package store
import (
	"fmt"
	"math/rand"
	"github.com/renproject/aw/wire"
	"github.com/renproject/kv/db"
)
type MultiAddrStore struct {
	store          db.Table
	bootstrapAddrs []wire.Address
}
func New(store db.Table, bootstrapAddrs []wire.Address) MultiAddrStore {
	multiStore := MultiAddrStore{
		store:          store,
		bootstrapAddrs: bootstrapAddrs,
	}
	for _, addr := range bootstrapAddrs {
		if err := multiStore.Insert(addr); err != nil {
			panic(fmt.Sprintf("[MultiAddrStore] cannot initialize the store with bootstrap nodes addresses"))
		}
	}
	return multiStore
}
func (multiStore *MultiAddrStore) Get(id string) (wire.Address, error) {
	var addrString string
	if err := multiStore.store.Get(id, &addrString); err != nil {
		return wire.Address{}, err
	}
	return wire.DecodeString(addrString)
}
func (multiStore *MultiAddrStore) Insert(addr wire.Address) error {
	signatory, err := addr.Signatory()
	if err != nil {
		return err
	}
	return multiStore.store.Insert(signatory.String(), addr.String())
}
func (multiStore *MultiAddrStore) Delete(addr wire.Address) error {
	signatory, err := addr.Signatory()
	if err != nil {
		return err
	}
	return multiStore.store.Delete(signatory.String())
}
func (multiStore *MultiAddrStore) Size() (int, error) {
	return multiStore.store.Size()
}
func (multiStore *MultiAddrStore) AddrsAll() ([]wire.Address, error) {
	addrs := []wire.Address{}
	iter := multiStore.store.Iterator()
	defer iter.Close()
	for iter.Next() {
		id, err := iter.Key()
		if err != nil {
			return nil, err
		}
		address, err := multiStore.Get(id)
		if err != nil {
			return nil, err
		}
		addrs = append(addrs, address)
	}
	return addrs, nil
}
func (multiStore *MultiAddrStore) BootstrapAll() ([]wire.Address, error) {
	return multiStore.bootstrapAddrs, nil
}