Skip to content

Update document #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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