Sha256: 2255207ff8510e4b1a498a856099b508681d8dfe9688ea8107227011bb083501

Contents?: true

Size: 699 Bytes

Versions: 17

Compression:

Stored size: 699 Bytes

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL logical `rand` operator.
    #
    # @example
    #   (rand)
    #
    # @see http://www.w3.org/TR/sparql11-query/#idp2130040
    class Rand < Operator::Nullary
      include Evaluatable

      NAME = :rand

      ##
      # Returns a pseudo-random number between 0 (inclusive) and 1.0e0 (exclusive). Different numbers can be produced every time this function is invoked. Numbers should be produced with approximately equal probability.
      #
      # @return [RDF::Literal::Double] random value
      def apply
        RDF::Literal::Double.new(Random.rand)
      end
    end # Rand
  end # Operator
end; end # SPARQL::Algebra

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sparql-1.99.1 lib/sparql/algebra/operator/rand.rb
sparql-1.1.9.1 lib/sparql/algebra/operator/rand.rb
sparql-1.99.0 lib/sparql/algebra/operator/rand.rb
sparql-1.1.9 lib/sparql/algebra/operator/rand.rb
sparql-1.1.8 lib/sparql/algebra/operator/rand.rb
sparql-1.1.7 lib/sparql/algebra/operator/rand.rb
sparql-1.1.6 lib/sparql/algebra/operator/rand.rb
sparql-1.1.5 lib/sparql/algebra/operator/rand.rb
sparql-1.1.4 lib/sparql/algebra/operator/rand.rb
sparql-1.1.3 lib/sparql/algebra/operator/rand.rb
sparql-1.1.2.1 lib/sparql/algebra/operator/rand.rb
sparql-1.1.2 lib/sparql/algebra/operator/rand.rb
sparql-1.1.1 lib/sparql/algebra/operator/rand.rb
sparql-1.1.0 lib/sparql/algebra/operator/rand.rb
sparql-1.1.0p0 lib/sparql/algebra/operator/rand.rb
sparql-1.0.8 lib/sparql/algebra/operator/rand.rb
sparql-1.0.7 lib/sparql/algebra/operator/rand.rb