random

package
v0.0.0-...-bd18503 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright (C) 2012-2013 Fuchun(Aying) All rights reserved.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomAlphaOrNumeric

func RandomAlphaOrNumeric(count uint, letters, numbers bool) string

Creates a random string whose length is the number of characters specified.

Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments.

Param count - the length of random string to create Param letters - if true, generated string will include

alphabetic characters

Param numbers - if true, generated string will include

numeric characters

func RandomAlphabetic

func RandomAlphabetic(count uint) string

Creates a random string whose length is the number of characters specified. Characters will be chosen from the set of alphabetic characters.

func RandomAlphanumeric

func RandomAlphanumeric(count uint) string

Creates a random string whose length is the number of characters specified. Characters will be chosen from the set of alpha-numeric characters.

func RandomAscii

func RandomAscii(count uint) string

Creates a random string whose length is the number of characters specified.

Characters will be chosen from the set of characters whose ASCII value is between 32 and 126 (inclusive).

func RandomNumString

func RandomNumString() string

func RandomNumeric

func RandomNumeric(count uint) string

Creates a random string whose length is the number of characters specified. Characters will be chosen from the set of numeric characters.

func RandomSpec0

func RandomSpec0(count uint, start, end int, letters, numbers bool,
	chars []rune, rand *rand.Rand) string

Creates a random string based on a variety of options, using supplied source of randomness.

If start and end are both 0, start and end are set to ' ' and 'z', the ASCII printable characters, will be used, unless letters and numbers are both false, in which case, start and end are set to 0 and math.MaxInt32.

If set is not nil, characters between start and end are chosen.

This method accepts a user-supplied rand.Rand instance to use as a source of randomness. By seeding a single rand.Rand instance with a fixed seed and using it for each call, the same random sequence of strings can be generated repeatedly and predictably.

func RandomSpec1

func RandomSpec1(count uint, start, end int, letters, numbers bool) string

Creates a random string whose length is the number of characters specified.

Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments.

Param count - the length of random string to create Param start - the position in set of chars to start at Param end - the position in set of chars to end before Param letters - if true, generated string will include

alphabetic characters

Param numbers - if true, generated string will include

numeric characters

func RandomString

func RandomString(count uint) string

func RandomStringSpec0

func RandomStringSpec0(count uint, set []rune) string

func RandomStringSpec1

func RandomStringSpec1(count uint, set string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL