A Random Feature

:pray: please be activated soon

4 Likes

So excited, I hope they activate it soon!

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.

2 Likes

Either tomorrow or early January.

7 Likes

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.

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

1 Like

In time for Christmas? :smirk:

1 Like

“In observance of the gift-giving season”

3 Likes

Ehh. Oh. Thanks.

This is now live.

26 Likes

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

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…

1 Like

Yeah, notice the interval notation:

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

1 Like

Yeah, the range is [min,max).

4 Likes

You don’t get the title, hmm?

It’s quite literally random

So in the example:

rng:NextNumber(0, 255)

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

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

2 Likes

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

1 Like

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

2 Likes