save before refactor

This commit is contained in:
NunoSempere 2024-02-25 18:25:58 -03:00
parent c61bae984c
commit 9f31a9161a

View File

@ -8,6 +8,11 @@ import (
) )
type src = *rand.Rand type src = *rand.Rand
type IntProbability {
N int64
p float64
}
type pplKnownDistrib = map[int64]float64 type pplKnownDistrib = map[int64]float64
func generatePeopleKnownDistribution(r src) map[int64]float64 { func generatePeopleKnownDistribution(r src) map[int64]float64 {
@ -120,7 +125,7 @@ func draw148PplFromDistributionAndCheck(d pplKnownDistrib, r src, show bool) int
func getUnnormalizedBayesianUpdateForDistribution(d pplKnownDistrib, r src) int64 { func getUnnormalizedBayesianUpdateForDistribution(d pplKnownDistrib, r src) int64 {
var sum int64 = 0 var sum int64 = 0
n := 100 n := 1000
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
/* if i%1000 == 0 { /* if i%1000 == 0 {
fmt.Println(i) fmt.Println(i)
@ -137,6 +142,7 @@ func main() {
var r = rand.New(rand.NewPCG(uint64(1), uint64(2))) var r = rand.New(rand.NewPCG(uint64(1), uint64(2)))
sum := int64(0) sum := int64(0)
distribs := [](int64, pplKnownDistrib){}
for i := 0; i < 1000; i++ { for i := 0; i < 1000; i++ {
people_known_distribution := generatePeopleKnownDistribution(r) people_known_distribution := generatePeopleKnownDistribution(r)
@ -146,6 +152,7 @@ func main() {
if result > 0 { if result > 0 {
fmt.Println(people_known_distribution) fmt.Println(people_known_distribution)
fmt.Println(result) fmt.Println(result)
distribs.append()
} }
sum += result sum += result
// fmt.Println(result) // fmt.Println(result)