Skip to content

Commit

Permalink
Update random to use new rand approach
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasinsaurralde committed Nov 15, 2023
1 parent eba5313 commit 8febdb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions random/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func ProteinSequence(length int, seed int64) (string, error) {

// https://en.wikipedia.org/wiki/Amino_acid#Table_of_standard_amino_acid_abbreviations_and_properties
var aminoAcidsAlphabet = []rune("ACDEFGHIJLMNPQRSTVWY")
rand.Seed(seed)
randomSource := rand.New(rand.NewSource(seed))

randomSequence := make([]rune, length)

Expand All @@ -31,7 +31,7 @@ func ProteinSequence(length int, seed int64) (string, error) {
//* is the standard abbreviation for the stop codon. That's a signal for the ribosome to stop the translation and because of that a protein sequence is finished with *
randomSequence[peptide] = '*'
} else {
randomIndex := rand.Intn(len(aminoAcidsAlphabet))
randomIndex := randomSource.Intn(len(aminoAcidsAlphabet))
randomSequence[peptide] = aminoAcidsAlphabet[randomIndex]
}
}
Expand Down

0 comments on commit 8febdb8

Please sign in to comment.