random number generator?

78 views
Skip to first unread message

Jonathon Paarlberg

unread,
Jan 20, 2016, 10:25:06 AM1/20/16
to OpenRefine
How do I write a transform statement that will randomly add a range of numbers to a value in a column? Actually, I want to slightly randomize some dates.

Tom Morris

unread,
Jan 20, 2016, 11:03:36 AM1/20/16
to openr...@googlegroups.com
GREL doesn't have a random function built in, but you could switch your expression language to Python/Jython and use something like :

import random

range = 42
return value + (range * random.random())

On Wed, Jan 20, 2016 at 10:25 AM, Jonathon Paarlberg <lion...@gmail.com> wrote:
How do I write a transform statement that will randomly add a range of numbers to a value in a column? Actually, I want to slightly randomize some dates.

--
You received this message because you are subscribed to the Google Groups "OpenRefine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrefine+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jonathon Paarlberg

unread,
Feb 8, 2016, 12:41:16 PM2/8/16
to OpenRefine
Thanks, Tom.
Reply all
Reply to author
Forward
0 new messages