A Random Feature


#41

:pray: please be activated soon


#42

So excited, I hope they activate it soon!


#43

Any thoughts on being able to hop to a specific integer or number instantly instead of calling :NextNumber() or :NextInteger() a lot of times? I’m working on a slide generator with different obstacles, some of which require warning signs earlier on in the slide. I’m generating the slide on the fly and I want to know beforehand when certain obstacles should spawn (depending on random values). If I can just hop a few steps forward/backwards at once it would make things a lot more convenient.


#44

Either tomorrow or early January.


#45

Call :NextNumber() or :NextInteger() a bunch of times in advance, and store the results to a table. This is probably the fastest way to do it at the moment.


#46

You could just use the noise function for something like that which would be easier. and you likely wouldn’t notice a difference if you “zoom out” enough with it


#47

In time for Christmas? :smirk:


#48

“In observance of the gift-giving season”


#49


#50

Ehh. Oh. Thanks.


#51

This is now live.


#52

Question about NextNumber(), technically, does it include the min, and approach the max?


#53

Found a minor quirk:

while wait() do
    local R = Random.new(-tick())
    print(R:NextNumber())
end

will print the same number for one second, until the seed changes.

I think that is expected as it’s not exactly the right way to use it, but…


#54

Yeah, notice the interval notation:

Closed at min, and open at max, so min <= x < max


#55

Yeah, the range is [min,max).


#57

You don’t get the title, hmm?

It’s quite literally random


#58

So in the example:

rng:NextNumber(0, 255)

Does this mean that you will never get 255 as a value?


#59

Since we’re talking about floats, not ints, would it really matter?


#60

That’s correct, you’ll never hit 255.


#61

Why not include the end value for NextNumber and make it consistent with how NextInteger works?