Assign random number to a list of thing

hello

say i want to upload a csv file and assign random number to each line of the database but the number must be different. how do i do that? i need help

Hi there, @asyraf.adlan… I could be off base here, but a handful of thoughts come to mind that seem to be better (to me, at least) than assigning the random number in Bubble and trying to figure out if each number is unique.

First, as I’m sure you know, each thing in a Bubble data type has a unique id already… so, is the random number really necessary? Second, can you generate the random numbers in the csv file and upload them as part of the file? Third, could you assign sequential numbers so you don’t have to worry about checking for uniqueness? Finally, could the random number be set up such that the chances of generating the same number are so small that it’s not worth checking for uniqueness?

Don’t get me wrong… you can do what you have described, but I guess what I am saying is that I would personally try to avoid it if possible, and without knowing exactly why you need to do it, I didn’t think it could hurt to throw some thoughts out there.

Best…
Mike

Hello @mikeloc

Thank you for the reply. yes i need to assign random number that is between 1-33. these numbers will determine the amount for my app to transfer money so they can tell my apps the amount they received to as a proof ownership of their bank account. is there any way for me to do it?

Regards,
Asyraf

You could use a backend workflow to assign the numbers, but I’m still not getting why you can’t include the random numbers in the csv. I could easily be missing something, but if you have to upload the csv anyway, why make Bubble create the random numbers and check them for uniqueness?

because the lines of the csv file is hundreds daily

@mikeloc how do i do that? if i use change a list of things it will assign the same number to all the lines. how do i make it different and within the range of 0.1-0.33 ?

This topic was automatically closed after 70 days. New replies are no longer allowed.