Class RandomFunction


  • public class RandomFunction
    extends java.lang.Object
    Function object for RAND and RAND_INTEGER, with and without seed.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Random random  
    • Constructor Summary

      Constructors 
      Constructor Description
      RandomFunction()
      Creates a RandomFunction.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double rand()
      Implements the RAND() SQL function.
      int randInteger​(int bound)
      Implements the RAND_INTEGER(bound) SQL function.
      int randIntegerSeed​(int seed, int bound)
      Implements the RAND_INTEGER(seed, bound) SQL function.
      double randSeed​(int seed)
      Implements the RAND(seed) SQL function.
      • Methods inherited from class java.lang.Object

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

      • random

        private java.util.Random random
    • Constructor Detail

      • RandomFunction

        public RandomFunction()
        Creates a RandomFunction.

        Marked deterministic so that the code generator instantiates one once per query, not once per row.

    • Method Detail

      • rand

        public double rand()
        Implements the RAND() SQL function.
      • randSeed

        public double randSeed​(int seed)
        Implements the RAND(seed) SQL function.
      • randInteger

        public int randInteger​(int bound)
        Implements the RAND_INTEGER(bound) SQL function.
      • randIntegerSeed

        public int randIntegerSeed​(int seed,
                                   int bound)
        Implements the RAND_INTEGER(seed, bound) SQL function.