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.180 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.179 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.178 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.177 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.176 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.175 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.174 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.173 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.172 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.171 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.170 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.169 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.167 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.166 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.165 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.164 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.163 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.162 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.161 tracks/go/exercises/robot-name/example.go
trackler-2.2.1.160 tracks/go/exercises/robot-name/example.go