randomopenrefinegoogle-refinegrel

How to generate random numbers with GoogleRefine or OpenRefine in GREL?


I'd like to generate random numbers in GREL. Is there any way to do this? I'd like to use a GREL phrase like:

"http://example.org/id/" + random + ".html"


Solution

  • GREL has not random function, but you can use Python/Jython instead :

    import random
    
    # return a random integer between 0 and 1000
    return value + str(random.randint(0, 1000)) + ".html"
    

    Example :

    enter image description here