[Plugin] RandomPlus

Post your completed addons to share with the community

Post » Thu May 23, 2013 7:26 pm

@cow_trix
Apologies for bringing this old thread up, but I can't figure the plugin out.

It takes three parameters, Seed/Min/Max.
If I set a seed and a Min/Max range, it should produce a persistent number for that seed, shouldn't it?
It doesn't, however. It produces random numbers within the range. Doesn't this defeat the point? My interest is in persistent seeded world generation.

Also, if I set min 10 and Max 100, it doesn't give me numbers from 10-99 (isn't that what the range is about?)

What am I missing? (running C2 r132)
Is there a new way to do this since then?

Is it best to use http://www.scirra.com/forum/plugin-seedrandom_topic60194.html ?christina2013-05-23 19:29:58
B
19
S
7
G
2
Posts: 188
Reputation: 2,846

Post » Thu May 23, 2013 8:02 pm

@christina

Seed gives you a repeatable random number. That means that every number generated with that seed will come out in the same order when you use that seed again.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu May 23, 2013 8:09 pm

@newt you're right! The example made me think the number is each time you hit the generate button.

Oh cool, this is perfect. Do you maybe know what RandomPlus-> Set Count to 0 means? It doesn't seem to do anything

Edit: ah got it, it returns the N randomly seeded number.

Thanks so much newt!christina2013-05-23 20:11:07
B
19
S
7
G
2
Posts: 188
Reputation: 2,846

Post » Thu May 23, 2013 8:12 pm

Its like another seed.
So if you were to set the count to 4, and the seed to 5 you would get different values than if you were to set the count to say 3, and seed to 5.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu May 23, 2013 8:30 pm

@newt you lifesaver :)

It seems however that min=0 means 0 and min=1 means 10 and min=2 means 20

@cow_trix are you sure you're not multiplying min*10 somewhere inside the plugin?
B
19
S
7
G
2
Posts: 188
Reputation: 2,846

Post » Sat Jul 13, 2013 11:28 am

Hey @christina, sorry for the late reply, I've been travelling for the past few months. Newt is correct on all counts except for what "Set Count to 0" does. This event basically resets the generator. For instance, the generator may output the following:

4 8 6 3 1 4 3 1

Resetting the count after all these values are generated means that the next value generated will be 4, then 8, and then so on and so forth. Basically the same numbers will be generated.

As for the problem with min/max, give me a bit to work it out. It's been over a year since I wrote this plugin and trying to understand old code is... fun.
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Previous

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests