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

518 views Asked by At

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"

1

There are 1 answers

2
Ettore Rizza On BEST ANSWER

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