Class Number


  • public class Number
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Number​(Faker faker)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String digit()  
      java.lang.String digits​(int count)  
      int numberBetween​(int min, int max)  
      long numberBetween​(long min, long max)
      Return a number between min and max.
      int randomDigit()
      Returns a random number from 0-9 (both inclusive)
      int randomDigitNotZero()
      Returns a random number from 1-9 (both inclusive)
      double randomDouble​(int maxNumberOfDecimals, int min, int max)  
      double randomDouble​(int maxNumberOfDecimals, long min, long max)
      Returns a random double
      long randomNumber()
      Returns a random number
      long randomNumber​(int numberOfDigits, boolean strict)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Number

        protected Number​(Faker faker)
    • Method Detail

      • randomDigit

        public int randomDigit()
        Returns a random number from 0-9 (both inclusive)
      • randomDigitNotZero

        public int randomDigitNotZero()
        Returns a random number from 1-9 (both inclusive)
      • numberBetween

        public long numberBetween​(long min,
                                  long max)
        Return a number between min and max. If min == max, then min is returned. So numberBetween(2,2) will yield 2 even though it doesn't make sense.
        Parameters:
        min - inclusive
        max - exclusive (unless min == max)
      • randomNumber

        public long randomNumber​(int numberOfDigits,
                                 boolean strict)
        Parameters:
        numberOfDigits - the number of digits the generated value should have
        strict - whether or not the generated value should have exactly numberOfDigits
      • randomNumber

        public long randomNumber()
        Returns a random number
      • randomDouble

        public double randomDouble​(int maxNumberOfDecimals,
                                   int min,
                                   int max)
      • randomDouble

        public double randomDouble​(int maxNumberOfDecimals,
                                   long min,
                                   long max)
        Returns a random double
        Parameters:
        maxNumberOfDecimals - maximum number of places
        min - minimum value
        max - maximum value
      • digits

        public java.lang.String digits​(int count)
      • digit

        public java.lang.String digit()