This website uses Cookies. Click Accept to agree to our website's cookie use as described in our Privacy Policy. Click Preferences to customize your cookie settings.

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Airtable Community
- Discussions
- Ask A Question
- Other questions
- Re: Random number functions

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Solved

Jump to Solution

2
5097
0

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Comment Post Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Aug 02, 2016 02:01 PM

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.

Solved! Go to Solution.

Reply

1 Solution

Accepted Solutions

Solved
See Solution in Thread

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jun 25, 2020 02:00 PM

first choose a MIN and MAX range for your random numbers then use the following formula:

(VALUE(DATETIME_FORMAT(CREATED_TIME(), ‘0.smh’))*(MAX-MIN))+MIN

this generates the following:

Reply

34 Replies 34

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Aug 02, 2016 02:56 PM

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Aug 02, 2016 03:03 PM

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.

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Oct 12, 2016 10:13 PM

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)

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Mar 17, 2017 10:43 AM

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Mar 20, 2017 12:42 AM

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jun 12, 2017 10:43 AM

PING. Any update on getting random number generator?

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jun 15, 2017 01:52 AM

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:

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jun 15, 2017 06:16 AM

Thanks. I’ll try that.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Jun 15, 2017 06:43 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 11, 2017 06:45 AM

Sorry but it is not working. With this formula I get the same numbers for several rows…

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 11, 2017 06:57 AM

Not very likely. Did you try to refresh the base?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 11, 2017 07:08 AM

Yes didn´t help.

May be I am doing something wrong?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 11, 2017 07:16 AM

Sorry. You are right. :slightly_smiling_face:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 11, 2017 07:17 AM

What it does is grab numbers from the RECORD_ID. So the numbers you see are random, but not unique.

The other trick (with time) maybe works better in your case.

A combination of the two methods is an option too of course…

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 11, 2017 07:21 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 11, 2017 07:23 AM

For order numbers you can also use AT’s Auto Number field. Maybe with something in front of it…

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 11, 2017 07:29 AM

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.

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 12, 2017 10:48 AM

Try `DATETIME_FORMAT(CREATED_TIME(),'X')`

.

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.

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Dec 14, 2017 03:43 AM

Thanks Vann Hall I will use that!