Package com.crawljax.forms
Class RandomInputValueGenerator
- java.lang.Object
-
- com.crawljax.forms.RandomInputValueGenerator
-
public class RandomInputValueGenerator extends Object
Class for generating random form data.- Author:
- dannyroest@gmail.com (Danny Roest)
-
-
Field Summary
Fields Modifier and Type Field Description private static intMAX_INTstatic doublePROBABILITY_CHECKprivate Randomrandom
-
Constructor Summary
Constructors Constructor Description RandomInputValueGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Stringgenerate(int length)booleangetCheck()<T> TgetRandomItem(List<T> options)StringgetRandomNumber()StringgetRandomString(int length)
-
-
-
Field Detail
-
PROBABILITY_CHECK
public static final double PROBABILITY_CHECK
- See Also:
- Constant Field Values
-
MAX_INT
private static final int MAX_INT
- See Also:
- Constant Field Values
-
random
private final Random random
-
-
Method Detail
-
generate
private String generate(int length)
- Parameters:
length-- Returns:
- a random string
-
getRandomString
public String getRandomString(int length)
- Parameters:
length- the length of the random string- Returns:
- random string
-
getRandomNumber
public String getRandomNumber()
-
getCheck
public boolean getCheck()
- Returns:
- whether to check with p=0.5
-
getRandomItem
public <T> T getRandomItem(List<T> options)
- Parameters:
options- the possible options (e.g. option item in select). The list must be non-empty- Returns:
- a random item from the list
-
-