Here’s a way to generate random number using formula field in airtable
first choose a MIN and MAX range for your random numbers then use the following formula:
this generates the following:
We don’t have any random number functions at the moment, but I’ll reach out to you once we implement something like this. Can you share why you need a random number function? We might be able to provide a workaround.
I use Airtable to generate sample data for prototyping/mocking up a series of applications my company is developing. I often want to have sample data that represents a meaningful distribution across a set of values. In the past I either used Excel or https://www.mockaroo.com/
It’d be great to just use one tool.
Am also missing a Random function,
Looking for a random function something like:
RANDOM(Seed, Range_Start, Range_End, Fraction_Digits)
use 0 to ignore seed
range start/end, either or both, could be negative.
fraction digits, for number of fraction digits in output
RANDOM(0,0,200) => 74 (0 for ignore seed, no fractional digits)
RANDOM(8495,-200,-100,5) => -158.78304 (8495 for seed, negative start and end, with 5 fractional digits)
RANDOM(8495,200,-100,5) => 158.78304 (8495 for seed, with 5 fractional digits, where start is higher than end)
RANDOM(VALUE(DATETIME_FORMAT(NOW(), ‘x’)),1000,2000,7) => 1622.9287305 (use current datetime to seed, with 7 fraction digits)
Hey @Daniel_Robbins, I thought of something.
If you create a formula with VALUE(RECORD_ID()) you’ll get random numbers for each record. Maybe you can use this a a starting point. With some additional formulas (or even rollups) you should be able to scale it / put it in a certain range.
You could actually expand that by using the CREATED_TIME() function too.
Grab the numbers from the time portion…
SUBSTITUTE(TIMESTR(CREATED_TIME()), ":", "")
Or only the seconds for example and use that to do an extra calculation, define a random position in the string (maybe with REPT) or whatever.
I want to hide the casenumbers to prevent vendors from gathering information out of it. So unfortunately this solution is not working for me.
In software like excel…you have the function RANDOM() for it.
That will give you the Unix timestamp as a string; e.g., ‘1511398652’. You can then chop it up or otherwise obfuscate it as necessary. The results won’t be random, but they should be unique — with one exception: The first three records in a table are created at the time the table is, and all bear the same timestamp.
In theory, you can use
'x' instead of
'X' as the format specifier and get the timestamp with milliseconds included — ‘1360013296123’ is the example from the Airtable help page — but it appears
CREATED_TIME() is stored precise to the second only. The results I get with
DATETIME_FORMAT(CREATED_TIME(),'x') all have three zeroes as the rightmost three digits.