Golang math/rand.ExpFloat64() function example
package math/rand
Golang math/rand.ExpFloat64() function usage example
package main
import (
"fmt"
"math/rand"
)
func main() {
sum := 0.0
n := 1000
i := 0
for i < n {
x := rand.ExpFloat64()
sum += x
i += 1
}
expect := sum / (float64)(n)
fmt.Println(expect)
}
Reference :
Advertisement
Something interesting
Tutorials
+9.9k Golang : Ordinal and Ordinalize a given number to the English ordinal numeral
+21.8k Golang : How to reverse slice or array elements order
+7.5k Golang : Process json data with Jason package
+14k Golang : concatenate(combine) strings
+21.9k Golang : Use TLS version 1.2 and enforce server security configuration over client
+21.1k Golang : Convert(cast) string to rune and back to string example
+7.8k Golang : Getting Echo framework StartAutoTLS to work
+5.4k Gogland : Datasource explorer
+5.8k Cash Flow : 50 days to pay your credit card debt
+11.7k Golang : Secure file deletion with wipe example
+19.9k Golang : Count JSON objects and convert to slice/array
+16.8k Golang : Get own process identifier