ChooseSliceIndices returns randomly chosen, valid indices for slicing.
(rand *rand.Rand)
| 290 | |
| 291 | // ChooseSliceIndices returns randomly chosen, valid indices for slicing. |
| 292 | func (l *TList) ChooseSliceIndices(rand *rand.Rand) (start, end int) { |
| 293 | if len(l.std) == 0 { |
| 294 | return 0, 0 |
| 295 | } |
| 296 | start = rand.Intn(len(l.std)) |
| 297 | end = rand.Intn(len(l.std)-start) + start |
| 298 | return start, end |
| 299 | } |
| 300 | |
| 301 | // Append adds v to the end of slice and List. |
| 302 | func (l *TList) Append(v int) { |