class SPARQL::Algebra::Operator::Rand

The SPARQL logical `rand` operator.

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.

@example

(rand)

@see www.w3.org/TR/sparql11-query/#idp2130040

Constants

NAME

Public Instance Methods

apply(**options) click to toggle source

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

# File lib/sparql/algebra/operator/rand.rb, line 21
def apply(**options)
  RDF::Literal::Double.new(Random.rand)
end