Random number generator

It would be great if there was a way to generate a random number instead of having the users rely on making a blockspring account or any other creative way.

I suggest the following implementation:

Is this possible?

You can already do this with Calculate formula > Generate Random String


Gaby | Coaching Bubble

4 Likes

The issue with that method is you can’t put bounds (min, max) on it. It would be possible if you can access the string that it generates as a number, then it’s possible to transform it to fit within a range.

Thanks, but not quite what I’m after. As your screenshot also shows, it’s generating a string and not an integer/float value. This makes it unusable in stuff asking for number inputs :slight_smile:

I tried generating a random string using numbers but there’s no “convert string to numbers” (and afaik that is not an easy task as it would have to interpret the string first. Would be a lot easier to just generate an integer/float without going through a string)

If you select “Use numbers” only, the value is a number (not a text string). I just tried it with 2 inputs (integer type) whose initial content is generated and added the values in a text element. It worked.

However, Scott is right that you don’t have any more control beyond number of digits. Can’t define a range or anything. Just spits out random numbers…

With the observation @romanmg made about inputs typecasting the value from a string to number, it’s possible. The following generates a random number between an arbitrary min and max of 2000 and 2999, respectively.

5 Likes

That’s odd that it works that way, during workflow it won’t see it as an integer.:sweat:
My custom state named “number” is set to type=number

Just reference the group on the page that stores the random value.

1 Like

That’s a workaround I am content with using, but my initial suggestion still stands. Thank you @Scott and @romanmg for this so far easiest bubble-only workaround :slight_smile:

1 Like

@Scott Any idea how you would change this random number via button press event? I see that we’re generating the number on “initial content” when the page loads, but is there a way to get a new random number from a workflow event?

Awesome workaround btw, thanks!

1 Like

Hi @asbjoern1990,

We just released a plugin that allows users to generate a random number with a minimum and maximum. Here’s the original post for it:

1 Like

@romanmg
This is awesome I was looking for a way to create a random string.

Any idea how I would go about using that string so clients could look at a webpage (of a user that has an account) instead of having to go through the login or signup process? Kind of like a read only page and only that user can give out this generated key.

Thanks!

I really need help , my references keep changing every time i refresh the page . How can i really fix this. How can i keep them static .