Sha256: a0c61a818f3ffc21216959813fdcd2378ad8ef5e0cb3dd52e3dcfba273374611

Contents?: true

Size: 330 Bytes

Versions: 242

Compression:

Stored size: 330 Bytes

Contents

// +build !bonus

package robotname

import (
	"fmt"
	"math/rand"
)

type Robot struct {
	name string
}

func (r *Robot) Name() string {
	if r.name == "" {
		r.name = fmt.Sprintf("%c%c%03d",
			'A'+byte(rand.Intn(26)),
			'A'+byte(rand.Intn(26)),
			rand.Intn(1000))
	}
	return r.name
}

func (r *Robot) Reset() {
	*r = Robot{}
}

Version data entries

242 entries across 242 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.138 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.137 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.136 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.135 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.134 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.133 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.132 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.131 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.130 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.129 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.128 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.127 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.126 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.125 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.124 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.123 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.122 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.121 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.120 tracks/go/exercises/robot-name/example.go