Golang math/rand.Float64() function example
package math/rand
Golang math/rand.Float64() function usage example
package main
import (
"fmt"
"math/rand"
)
func main() {
n := 1000
i := 0
var x float32
for i < n {
x = rand.Float64()
i += 1
}
fmt.Println("x : ", x)
fmt.Println("i : ", i)
}
Reference :
Advertisement
Something interesting
Tutorials
+11.7k Golang : Secure file deletion with wipe example
+20.7k Golang : Read directory content with os.Open
+4.4k Golang : Valued expressions and functions example
+8.3k Golang: Prevent over writing file with md5 hash
+10.6k Golang : Bubble sort example
+19.9k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+9.9k Golang : Check if user agent is a robot or crawler example
+15.2k JavaScript/JQuery : Detect or intercept enter key pressed example
+14k Golang: Pad right or print ending(suffix) zero or spaces in fmt.Printf example
+28.6k Get file path of temporary file in Go
+8.3k Golang : Auto-generate reply email with text/template package