[Request] Random Number Generator

Post your work in progress addons and get feedback

Post » Sat Mar 08, 2014 7:40 am

http://davidbau.com/archives/2010/01/30 ... .html#more

I need someone to add the above RNG to Construct 2.
It's already in JS.
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Sun Mar 09, 2014 5:12 pm

You might see this.
B
109
S
27
G
277
Posts: 4,481
Reputation: 154,922

Post » Mon Mar 10, 2014 3:29 am

viewtopic.php?t=76204&start=0
I would like an updated version of the above. He's made improvements upon the implementation:
Update 11/10/2013: I am getting ready to release a version 2.3 (same random sequence) designed to be slightly friendlier to use in node.js, and I got a chance to test the PRNG quality using the dieharder random number test suite, which collects billions of outputs and tests for non-random patterns. To provide input data to dieharder, I just called seedrandom from node.js and tested the output stream of 32-bit numbers generated by Math.floor(Math.random() * 4294967296).

Here is the dieharder analysis of the sequence starting with Math.seedrandom(1). Note that the "WEAK" asessment is given for tests that result in a p that is near zero or near one, but because more than a hundred tests were run, we expect occasional tests to come in big or small - indeed if no tests were reported "WEAK", it would be an indication of a problem. Overall, the performance of this little javascript PRNG is pretty robust.

Update 1/1/2014: seedrandom is now available as a package in npm and bower. The current version number is 2.3.1.
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Thu Mar 27, 2014 4:24 am

I don't think randomplus works anymore, it only appears to have one action.

Can someone please add the RC4 random number generator that I specified? Shouldn't be too difficult. I don't understand the SDK myself.
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Thu Mar 27, 2014 4:09 pm

RandomPlus is your best shot.
Why would you expect more than one action ? A random generator with seed is nothing more than one action.
Ok, RandomPlus is not the same algorithm, but from the moment it gives you back the same "random" number when you use the same seed, that's all you need, don't you ?

In the absolute, it's just mathematic, you don't even need a third-part plugin and could implement it yourself in events.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,310
Reputation: 71,084

Post » Sat Mar 29, 2014 9:16 pm

okay, then, I can't figure out how to seed the random number generator, the action does not say "seed," it says set count to n, the randomplus object properties are few (I guess I don't specify a seed in the layout tab?)

i don't know what randomplus.count or randomplus.pickedcount or randomplus.randplus does

and yes, but I don't trust my programming skill sufficiently to avoid breaking everything in subtle ways


and rc4 is slightly better then mersenne primes
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Sun Mar 30, 2014 12:48 am

@ryackov

Random gen
B
109
S
27
G
277
Posts: 4,481
Reputation: 154,922

Post » Sun Mar 30, 2014 6:34 am

Thank you, and to reinforce my point on random plus: http://imgur.com/94GJkaa the example capx only contains two events and it's not clear what those two events precisely do
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Sun Mar 30, 2014 7:11 am

I amend my previous statement.
rex_randomgen doesn't work: http://imgur.com/wDhMuQd
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Sun Mar 30, 2014 8:01 am

The RandomPlus thread contains posts that explain how the plugin is supposed to work/be used.
The first post explains that the plugin gives pretty much a modification of the random() expression.
This system expression expects a range (a minimum number and a maximum).
The action "RandPlus" adds a seed to it.
Just go through the two pages of the thread, it's explained.
Moreover, you can check the inline help for the plugin (from within Construct2 itself) to see what values are expected in what field. Like for any other plugin.

.count and .pickedcount are common expressions to all plugins.


As for Rex's generator, you first have to use the Seed() action to set your seed, and then get the random() expression using that seed.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,310
Reputation: 71,084

Next

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 1 guest