figure out return values & global var

This commit is contained in:
NunoSempere 2024-02-16 00:25:36 +01:00
parent 5a36bec0ba
commit 934c84e195
3 changed files with 11 additions and 4 deletions

View File

@ -1,2 +1,2 @@
run: run:
go run hello.go go run squiggle.go

View File

@ -1,3 +1,4 @@
- [ ] Hello world program - [x] Hello world program
- [ ] Look into randomness sources in go - [x] Look into randomness sources in go
- rand/v2 api: <https://pkg.go.dev/math/rand/v2>
- [ ] - [ ]

View File

@ -3,8 +3,14 @@ package main
import "fmt" import "fmt"
import rand "math/rand/v2" import rand "math/rand/v2"
var r = rand.New(rand.NewPCG(1, 2))
func sample_unit_normal() float64 {
return 1.0
}
func main() { func main() {
r := rand.New(rand.NewPCG(1, 2))
fmt.Println("Hello world!") fmt.Println("Hello world!")
fmt.Printf("%v\n", r.Float64()) fmt.Printf("%v\n", r.Float64())
fmt.Printf("%v\n", r.NormFloat64())
} }