What is equivalent of RAND() in appsheet?

chiukim_0-1687501498750.png

In google sheet, there is a rand() function that generates a random numbers from time to time. I need this function in appsheet. Coz. if i will use this google sheet column in appsheet the data doesnt change from time to time. 

Solved Solved
0 8 345
1 ACCEPTED SOLUTION

8 REPLIES 8

Do you want the function within AppSheet or in your table?

If it's inside your app, you can use RANDBETWEEN() 

Yes. inside app formula. I want a formula for columns that changes its value from time to time. like the rand() function in google sheet. 

So you need the random number to be updated to a new random number periodically?

You could do that with an action easily enough. 

You would simply go to the 'Do this' section and give it a Data action to change values in the current row. Then set the action to the RANDBETWEEN() and it would recalculate it.

Then set the action to be run when the a form is saved for example, or the user simply clicks the button.

I'm curious, what purpose do you have in mind for this kind of functionality?

No new rows will be added. The scenario is i have 21 rows. then i have a column random which have random numbers as shown in the above example. I want this column to be change its value from time to time.

Im creating a examination app and i want my question to be randomized in order. So i came up in this function to a assign a random numbers then I will rank it up in order. 

I try the randbetween() function but the output has the same value with the others. the expected value should be distinct/unique. 


@chiukim wrote:

I try the randbetween() function but the output has the same value with the others. the expected value should be distinct/unique. 


I've also observed this when using the RANDBETWEEN function in a virtual column's app formula expression--the function is apparently calculated only once and the value is used for all rows.

If you haven't already: Try using a data source column. You could create an action to force recalculation of all rows that you invoke periodically via a button or even a scheduled automation.

recalculation? by what means? havent tried this action. 

@chiukim 

Set the "Initial value" property of the column to the following expression:

 

RANDBETWEEN(1, 100)

 

 This will generate a random number between 1 and 100 when a new row is added.

RANDBETWEEN(1, 100) + NOW()

This expression adds the current timestamp (NOW()) to the random number, ensuring that a new random number is generated each time the row is edited.

Top Labels in this Space