Golang math/rand.NewZipf() and Zipf.Uint64() functions example
package math/rand
Golang math/rand.NewZipf() and Zipf.Uint64() functions usage example
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
n := 10
i := 0
r := rand.New(rand.NewSource(time.Now().UnixNano()))
zipf := rand.NewZipf(r, 3.14, 2.72, 5000)
for i < n {
fmt.Println(zipf.Uint64())
i += 1
}
}
References :
Advertisement
Something interesting
Tutorials
+5.3k Golang : Get missing location after unmarshal binary and gob decode time.
+18.8k Golang : Check if os.Stdin input data is piped or from terminal
+9.4k Android Studio : Simple input textbox and intercept key example
+4.9k Fix yum-complete-transaction error
+5.7k Golang : Totalize or add-up an array or slice example
+7k Swift : Convert (cast) String to Double
+39.4k Golang : How do I convert int to uint8?
+14.6k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+4.7k Javascript : Shuffle or randomize array example
+4k Linux : How to set root password in Linux Mint
+6.1k Golang : Levenshtein distance example