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.159 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.158 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.157 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.156 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.155 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.154 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.153 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.152 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.151 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.150 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.149 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.148 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.147 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.146 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.145 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.144 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.143 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.142 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.141 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.140 tracks/go/exercises/robot-name/example.go