"A" "ACGT" st := "ACGT" len(st) "" len("") import "math/rand" st = "ACGT" string(st[rand.Intn(len(st))]) // generating a random nucleotide string(st[rand.Intn(len(st))]) // repeated invocations might yield different nucleotides string(st[rand.Intn(len(st))]) // repeated invocations might yield different nucleotides string(st[rand.Intn(len(st))]) // repeated invocations might yield different nucleotides string(st[rand.Intn(len(st))]) // repeated invocations might yield different nucleotides // make random nucleotide string by concatenating random nucleotides import "bytes" var b bytes.Buffer for i := 0; i < 40; i++ { b.WriteByte(st[rand.Intn(len(st))]) } st = b.String() st st[1:3] // substring, starting at position 1 and extending up to but not including position 3 // note that the first position is numbered 0 st[0:3] // prefix of length 3 st[:3] // another way of getting the prefix of length 3 st[len(st)-3:len(st)] // suffix of length 3 st[-3:] // another way of getting the suffix of length 3 st1, st2 := "CAT", "ATAC" st1 st2 st1 + st2 // concatenation of 2 strings