Skip to content

Commit

Permalink
Merge pull request #5 from goark/v2-develop
Browse files Browse the repository at this point in the history
Update document
  • Loading branch information
spiegel-im-spiegel committed Mar 9, 2024
2 parents a1765aa + 34028da commit 701c33b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,27 @@ func main() {
### Usage of [mt][github.com/goark/mt/v2].PRNG type (concurrency-safe version)

```go
package main

import (
"fmt"

"github.com/goark/mt/v2"
"github.com/goark/mt/v2/mt19937"
)

fmt.Println(mt.New(mt19937.New(19650218)).Uint64())
//Output:
//13735441942630277712
func main() {
fmt.Println(mt.New(mt19937.New(19650218)).Uint64())
//Output:
//13735441942630277712
}
```

#### Use [io].Reader interface

```go
package main

import (
"encoding/binary"
"fmt"
Expand Down
5 changes: 0 additions & 5 deletions mt19937/mt19937.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ func (s *Source) Uint64() uint64 {
return x
}

// // Int63 generates a random number on [0, 2^63-1]-interval
// func (s *Source) Int63() int64 {
// return (int64)(s.Uint64() >> 1)
// }

// Real generates a random number
// on [0,1)-real-interval if mode==1,
// on (0,1)-real-interval if mode==2,
Expand Down
4 changes: 2 additions & 2 deletions sample/sample2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main

import (
"fmt"
stdrand "math/rand/v2"
"math/rand/v2"
"sync"
"time"

Expand All @@ -16,7 +16,7 @@ import (
func main() {
start := time.Now()
wg := sync.WaitGroup{}
prng := mt.New(mt19937.New(stdrand.Int64()))
prng := mt.New(mt19937.New(rand.Int64()))
for i := 0; i < 1000; i++ {
wg.Add(1)
go func() {
Expand Down

0 comments on commit 701c33b

Please sign in to comment.