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
+13.9k Golang : Get dimension(width and height) of image file
+10k CodeIgniter : Load different view for mobile devices
+7.1k Golang : Squaring elements in array
+14.3k Golang : Get uploaded file name or access uploaded files
+4.8k Golang : A program that contain another program and executes it during run-time
+5.3k Javascript : Shuffle or randomize array example
+29.7k Golang : Record voice(audio) from microphone to .WAV file
+14.1k Golang : Check if a file exist or not
+23.9k Golang : Use regular expression to validate domain name
+19.9k Golang : How to get time from unix nano example
+15.2k Golang : Accurate and reliable decimal calculations
+11.1k Golang : Simple image viewer with Go-GTK