Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
StringTools[Random] - return a random string
StringTools[Randomize] - seed the random number generator
Calling Sequence
Random( len, alphabet )
Randomize()
Randomize( seed )
Parameters
len
-
positive integer; length of string to generate
alphabet
(optional) string or symbol; restricts the characters that form the string
seed
(optional) integer; seed for the random number generator
Description
The Random(len, alphabet) calling sequence generates a random string of a given length, with the option of restricting the characters that form the returned string.
The Random(len) calling sequence returns a string of length len whose characters are randomly distributed and in the numeric range . That is, any non-zero 8-bit character can appear, and all appear with equal likelihood.
If the second optional argument, alphabet, is included in the calling sequence, it specifies the "alphabet" upon which the random string is generated. This option can assume one of two forms. If it is of type string, then the characters in that string are taken to be the alphabet from which to randomly draw characters in the output string. The alphabet characters must appear in US-ASCII order and cannot contain repetitions.
If the alphabet parameter is a symbol, then it must be one of the following recognized character class names.
Symbol
Range of Characters
alpha
A-Z or a-z
ascii
ASCII code 1 through 127
alnum
A-Z, a-z, or 0-9
binary
0 or 1
cntrl
FF, NL, CR, HT, VT, BEL, or BS
digit
0-9
dna
A,C,G or T
graph
alnum or punct
xdigit
0-9, a-f, or A-F
ident
A-Z, a-z, 0-9, or _
ident1
A-Z, a-z, or _
lower
a-z
octal
0-7
print
punct, alnum, or space character (" ")
punct
ascii and not in alnum, space, or cntrl
space
tab ("\t"), newline ("\n"), vertical tab ("\v")
form-feed ("\f"), or space (" ")
upper
A-Z
Because the random number generator used by Random is independent of the random number generator rand, the randomize command cannot be used to seed the former. Therefore, the StringTools package provides the Randomize command that can be used to seed the random number generator Random used by the StringTools package.
The Randomize command takes a positive integer argument seed as its sole argument. This number is used to seed the random number generator. The seed argument is optional, however, and a value derived from the system clock will be used to seed the random number generator if the seed argument is omitted.
Examples
See Also
convert, length, max, min, op, rand, randomize, RandomTools, string, StringTools, StringTools[AndMap], StringTools[IsAlphaNumeric], StringTools[IsDigit], type[string]
Download Help Document