0

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"

CH_
  • 685
  • 1
  • 7
  • 18

1 Answers1

5

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

Ettore Rizza
  • 2,800
  • 2
  • 11
  • 23
  • Thanks @ostephens on twitter shared a similar solution meanwhile: import random return random.randint(1,9) Source: https://twitter.com/hauschke/status/839110740795666433 – CH_ Mar 07 '17 at 13:50
  • 1
    Owen is the best user of Open refine I know, and I'm proud to have been faster this time. ^^ – Ettore Rizza Mar 07 '17 at 13:58