Java Doc for RandomStringUtils.java in  » Library » Apache-common-lang » org » apache » commons » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache common lang » org.apache.commons.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.lang.RandomStringUtils

RandomStringUtils
public class RandomStringUtils (Code)

Operations for random Strings.

Currently private high surrogate characters are ignored. These are unicode characters that fall between the values 56192 (db80) and 56319 (dbff) as we don't know how to handle them. High and low surrogates are correctly dealt with - that is if a high surrogate is randomly chosen, 55296 (d800) to 56191 (db7f) then it is followed by a low surrogate. If a low surrogate is chosen, 56320 (dc00) to 57343 (dfff) then it is placed after a randomly chosen high surrogate.


author:
   Steven Caswell
author:
   Stephen Colebourne
author:
   Gary Gregory
author:
   Phil Steitz
since:
   1.0
version:
   $Id: RandomStringUtils.java 471626 2006-11-06 04:02:09Z bayard $



Constructor Summary
public  RandomStringUtils()
    

RandomStringUtils instances should NOT be constructed in standard programming.


Method Summary
public static  Stringrandom(int count)
    
public static  Stringrandom(int count, boolean letters, boolean numbers)
    
public static  Stringrandom(int count, int start, int end, boolean letters, boolean numbers)
    
public static  Stringrandom(int count, int start, int end, boolean letters, boolean numbers, char[] chars)
    

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

This method has exactly the same semantics as RandomStringUtils.random(int,int,int,boolean,boolean,char[],Random) , but instead of using an externally supplied source of randomness, it uses the internal static Random instance.


Parameters:
  count - the length of random string to create
Parameters:
  start - the position in set of chars to start at
Parameters:
  end - the position in set of chars to end before
Parameters:
  letters - only allow letters?
Parameters:
  numbers - only allow numbers?
Parameters:
  chars - the set of chars to choose randoms from.If null, then it will use the set of all chars.
public static  Stringrandom(int count, int start, int end, boolean letters, boolean numbers, char[] chars, Random random)
    

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 Integer.MAX_VALUE.

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

This method accepts a user-supplied Random instance to use as a source of randomness.

public static  Stringrandom(int count, String chars)
    
public static  Stringrandom(int count, char[] chars)
    
public static  StringrandomAlphabetic(int count)
    
public static  StringrandomAlphanumeric(int count)
    
public static  StringrandomAscii(int count)
    
public static  StringrandomNumeric(int count)
    


Constructor Detail
RandomStringUtils
public RandomStringUtils()(Code)

RandomStringUtils instances should NOT be constructed in standard programming. Instead, the class should be used as RandomStringUtils.random(5);.

This constructor is public to permit tools that require a JavaBean instance to operate.





Method Detail
random
public static String random(int count)(Code)

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

Characters will be chosen from the set of all characters.


Parameters:
  count - the length of random string to create the random string



random
public static String random(int count, boolean letters, boolean numbers)(Code)

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.


Parameters:
  count - the length of random string to create
Parameters:
  letters - if true, generated string will includealphabetic characters
Parameters:
  numbers - if true, generated string will includenumeric characters the random string



random
public static String random(int count, int start, int end, boolean letters, boolean numbers)(Code)

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.


Parameters:
  count - the length of random string to create
Parameters:
  start - the position in set of chars to start at
Parameters:
  end - the position in set of chars to end before
Parameters:
  letters - if true, generated string will includealphabetic characters
Parameters:
  numbers - if true, generated string will includenumeric characters the random string



random
public static String random(int count, int start, int end, boolean letters, boolean numbers, char[] chars)(Code)

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

This method has exactly the same semantics as RandomStringUtils.random(int,int,int,boolean,boolean,char[],Random) , but instead of using an externally supplied source of randomness, it uses the internal static Random instance.


Parameters:
  count - the length of random string to create
Parameters:
  start - the position in set of chars to start at
Parameters:
  end - the position in set of chars to end before
Parameters:
  letters - only allow letters?
Parameters:
  numbers - only allow numbers?
Parameters:
  chars - the set of chars to choose randoms from.If null, then it will use the set of all chars. the random string
throws:
  ArrayIndexOutOfBoundsException - if there are not(end - start) + 1 characters in the set array.



random
public static String random(int count, int start, int end, boolean letters, boolean numbers, char[] chars, Random random)(Code)

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 Integer.MAX_VALUE.

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

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


Parameters:
  count - the length of random string to create
Parameters:
  start - the position in set of chars to start at
Parameters:
  end - the position in set of chars to end before
Parameters:
  letters - only allow letters?
Parameters:
  numbers - only allow numbers?
Parameters:
  chars - the set of chars to choose randoms from.If null, then it will use the set of all chars.
Parameters:
  random - a source of randomness. the random string
throws:
  ArrayIndexOutOfBoundsException - if there are not(end - start) + 1 characters in the set array.
throws:
  IllegalArgumentException - if count < 0.
since:
   2.0



random
public static String random(int count, String chars)(Code)

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

Characters will be chosen from the set of characters specified.


Parameters:
  count - the length of random string to create
Parameters:
  chars - the String containing the set of characters to use,may be null the random string
throws:
  IllegalArgumentException - if count < 0.



random
public static String random(int count, char[] chars)(Code)

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

Characters will be chosen from the set of characters specified.


Parameters:
  count - the length of random string to create
Parameters:
  chars - the character array containing the set of characters to use,may be null the random string
throws:
  IllegalArgumentException - if count < 0.



randomAlphabetic
public static String randomAlphabetic(int count)(Code)

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

Characters will be chosen from the set of alphabetic characters.


Parameters:
  count - the length of random string to create the random string



randomAlphanumeric
public static String randomAlphanumeric(int count)(Code)

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

Characters will be chosen from the set of alpha-numeric characters.


Parameters:
  count - the length of random string to create the random string



randomAscii
public static String randomAscii(int count)(Code)

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).


Parameters:
  count - the length of random string to create the random string



randomNumeric
public static String randomNumeric(int count)(Code)

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

Characters will be chosen from the set of numeric characters.


Parameters:
  count - the length of random string to create the random string



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.