gofrs / uuid

A UUID package for Go
MIT License
1.57k stars 110 forks source link

Add a generator's constructor with custom `io.Reader` as rand data source #114

Closed inaneverb closed 1 year ago

inaneverb commented 1 year ago

Hello.

So, it's likely proposal and discussion start. Don't you mind to add a generator's constructor that allows to specify custom rand data source? Something like this:

func NewGenWithRand(r io.Reader) *Gen {
    return &Gen{
        epochFunc:  time.Now,
        hwAddrFunc: defaultHWAddrFunc,
        rand:       r,
    }
}
cameracker commented 1 year ago

Hi, this PR grants the ability to provide option functions to a generator constructor

https://github.com/gofrs/uuid/pull/111/files

Does this meet your usecase?

cameracker commented 1 year ago

Closing as resolved, please let me know if it turns out the functionality doesn't work for you!