Skip to content
Snippets Groups Projects
Commit 7fd943c0 authored by Balthazar Wilson's avatar Balthazar Wilson
Browse files

fix: naming and useless Seed generation

parent 22081b5d
No related branches found
No related tags found
No related merge requests found
......@@ -2,14 +2,13 @@ package comsoc
import (
"math/rand"
"time"
)
func GenerateProfile(nVoters int, nAlts int)(profil Profile) {
func GenerateProfile(nVoters int, nAlts int) (profile Profile) {
// Initialisation du profil
profil = make([][]Alternative, nVoters)
for i := range profil {
profil[i] = make([]Alternative, nAlts)
profile = make([][]Alternative, nVoters)
for i := range profile {
profile[i] = make([]Alternative, nAlts)
}
// Définition des alternatives
......@@ -19,8 +18,7 @@ func GenerateProfile(nVoters int, nAlts int)(profil Profile) {
}
// Remplissage du profil avec des permutations différentes à chaque rang
rand.Seed(time.Now().UnixNano())
for i := range profil {
for i := range profile {
// Mélange les valeurs pour chaque ligne
permutation := make([]Alternative, len(values))
copy(permutation, values)
......@@ -29,7 +27,7 @@ func GenerateProfile(nVoters int, nAlts int)(profil Profile) {
})
// Remplit la ligne avec la permutation
copy(profil[i], permutation)
copy(profile[i], permutation)
}
return profil
}
\ No newline at end of file
return profile
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment