# Updated rand and wakeRand functions

With all the testing I’ve done with the random function I’ve noticed some serious limitations that a few adjustments could make this function incredible. Right now I feel like there are two things holding it back.

1. The random number generated in the rand fuction seems to generate a new number every millisecond. This can produce very interesting effects when used correctly but that quick of a value change also really hinders what can be done with it.

2. When using the same string for multiple objects each object is effected by the same random number each time. Say you wanted 3 objects to appear on random locations in the X axis, all three will appear in the same location because they are all using the same random number. Both rand and wakeRand seem to be effected by this problem.

Here’s my proposal,

rand(name, min, max, interval)

wakeRand(name,min,max)

Name= Assigning a number to this random string. If you wanted 3 objects to have a different random value but within the same min/max, you can assign them 1, 2, and 3. Say you had a 4th object that you wanted to have the same random value as #2 you could put 2 in the name value so 2 & 4 will be effected by the same random number.

Min= no changes

Max= no changes

Interval= How many seconds in between random numbers generated. (This would be unnecessary for wakeRand) You can use decimal points if you want to have it change faster than 1 second.

I think with these adjustments the random function can become incredibly powerful and could make some great animations. Thank you in advance for taking the time to read this @Facer_Official

Good idea!

Btw: As well other functions should be reinforced and extended with the possibility to define the starting time (sin, cos …) In most cases it‘s a mess that they all start at the same time.

1 Like

@GAUSS Do you think the vote button at the top really makes a difference as to how they view a suggestion?

No.

Just ran into these issues while trying to make three elements on a face fade in and out randomly. Tried using Rand, but the results were just not what I wanted. Wakerand came out as you mentioned, all three elements acted exactly the same.

Is there a topic with a workaround for this problem?

Try using different min max for each element, this worked ok for me. For example, 3 elements with 4 posibilities, for the first use 1-4, the second 5-8 and so…

I have tried that also but the results were that the face did have random effects although the different elements were seemingly random but they all still were changing together. For example if the square was randomly blue, the circle would always be red and the triangle would always be yellow even though they technically had a different random value.

@carlosfilippa - I have done that based on stuff I found in other threads. If only the wakeRand were instance-specific we wouldn’t even be having these discussions.

Thanks for the suggestion!

Yeah, or you can set different seeds, I know, but in the meantime there’s workarounds… Some simples, others more complexes based on math (you can also double, triple the range of some elements and then divide the result and make a floor to get the integer, or ask for new ranges in the result)

If they would rebuild the random in a similar way to what I suggested it would be way more useful especially for building games.

1 Like

Off course! Is a ultra valid asking, and I support it. I just wanted to help until then…

Oh I know and thank you for that. What I was really saying was more like I wish they would just rebuild it. That’s all. thanks for trying to help out. For sake of conversation though here’s a link to my face where I used different random values for each of the 4 parts that changes colors. As you can see there is a strict pattern. It appears random but it’s only semi random.

1 Like