Help

Re: Random number functions

Solved
Jump to Solution
14501 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel_Robbins
6 - Interface Innovator
6 - Interface Innovator

Perhaps I’m missing it, but how do I generate random numbers? I am missing “randbetween” and “rnd” from Excel.
Thanks for any and all help.

1 Solution

Accepted Solutions
Mahmoud_Habib
5 - Automation Enthusiast
5 - Automation Enthusiast

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:
image
(VALUE(DATETIME_FORMAT(CREATED_TIME(), ‘0.smh’))*(MAX-MIN))+MIN
this generates the following:
image

See Solution in Thread

39 Replies 39
Katherine_Duh
Airtable Alumni (Retired)

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.

prem
5 - Automation Enthusiast
5 - Automation Enthusiast

Am also missing a Random function,

  • which would take a Random Seed.
  • Allow negative to positive range
  • Allow fractions

Looking for a random function something like:
RANDOM()
RANDOM(Seed)
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)

Ron_Sheridan
5 - Automation Enthusiast
5 - Automation Enthusiast

I am looking for a RANDOM Sort capability. I am building a table of Questions to be entered into an app and I want to randomize the questions before they are manually entered or imported.

@Ron_Sheridan if you have any input at all when it comes to development of that app, it would probably be a couple of minutes work for the programmer to shuffle the questions over there before they are shown. :slightly_smiling_face:

Daniel_Robbins
6 - Interface Innovator
6 - Interface Innovator

PING. Any update on getting random number generator?

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.

:slightly_smiling_face:

Thanks. I’ll try that.

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.