[Plugin] RandomPlus

Post your completed addons to share with the community

Post » Fri Oct 14, 2011 1:52 pm

Wooo, my first plugin!

This plugin uses a Javascript port of the Mersenne Twister PRNG algorithm located here: https://gist.github.com/300494

Basically, the normal random() function in JS doesn't let you specify a seed, which is a problem if you want predictability in your randomness (little bit oxymoronic).

The main use I thought of for this is with world generation. Makes it a lot more efficient to save generated worlds, as you only have to save the seed and anything that the player has changed and you can just generate the rest on the fly.

The plugin can be found here:

http://dl.dropbox.com/u/1378330/RandomPlus/Random%20Plus.zip

A little example can be seen here:

http://dl.dropbox.com/u/1378330/RandomPlus/RandomPlus%20Example/index.html

The capx for that is here:

http://dl.dropbox.com/u/1378330/RandomPlus/RandomPlusExample.capx

Can anyone tell me why I'm getting that '0' at the beginning?cow_trix2011-10-14 15:29:30
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Sun Jan 08, 2012 10:30 pm

Thank you, I'm glad this exists, I was just looking for a way to seed.
B
34
S
4
G
8
Posts: 67
Reputation: 5,857

Post » Sun Apr 29, 2012 3:09 pm

@cow_trix

Thanks, I am looking for this, too, in my mutli-player project.
B
97
S
22
G
178
Posts: 4,118
Reputation: 104,043

Post » Tue May 01, 2012 11:53 pm

I made another random generator from @cow_trix 's reference
https://gist.github.com/300494

It could use independent, or provide random generator to other plugins like instance group.rexrainbow2012-05-01 23:58:24
B
97
S
22
G
178
Posts: 4,118
Reputation: 104,043

Post » Sat Jun 02, 2012 5:17 am

I love the plugin, I can't figure out why it's not randomizing my planet layout. Can someone help please?
http://dl.dropbox.com/u/38339554/RogueLike.capx

Edit: You might need this plugin: http://www.scirra.com/forum/behavior-spaceship-movement-behavior_topic44038.htmlPython2012-06-03 00:00:55
B
16
S
4
G
1
Posts: 47
Reputation: 2,542

Post » Wed Jul 04, 2012 10:29 pm

Is this generating random values in the [0,1) range? (As in 0 is included, 1 is excluded.)
Thank you
B
9
S
1
Posts: 5
Reputation: 1,312

Post » Wed Oct 17, 2012 7:36 am

[QUOTE=cow_trix]

Can anyone tell me why I'm getting that '0' at the beginning?[/QUOTE]

Something to do with The 'first' range Value
If it is from 0 to 10 you get
0xx.xxxxxxx
If it is range 1 to 10 you get
1xx.xxxxxxx

Just a little quirk i noticed, unless that is what you meant to do...
B
22
S
7
G
4
Posts: 14
Reputation: 4,630

Post » Wed Oct 17, 2012 7:53 pm

What would be really cool is the ability to set a random range but tell it to ignore certain numbers. So if you want it to ignore the number 7 and that came up it would automatically pick another number.
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Sat Jan 26, 2013 3:57 am

Is there I way I can store a player's world in the seed?
B
29
S
7
G
3
Posts: 361
Reputation: 6,187

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

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests