Source of random numbers

Discussion and feedback on Construct 2

Post » Fri Mar 07, 2014 5:07 pm

What is the pseudorandom number generator used?
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Fri Mar 07, 2014 6:57 pm

In Construct 2?
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Fri Mar 07, 2014 7:21 pm

I would use choose(randoma,randomb,randomc,randomd,randome,etc)
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Fri Mar 07, 2014 8:00 pm

I think he means what is the method used by Construct 2's random number generator. No computer number is actually random. Pseudo-random numbers are generated by using the clock and/or other algorithms.

Unfortunately, it's not documented. Maybe something is listed in the SDK? I'd start there or pm Ashley directly.
B
16
S
2
G
4
Posts: 42
Reputation: 2,642

Post » Fri Mar 07, 2014 9:30 pm

I believe that Construct classic used mersenne twister. So its possible that C2 uses the same thing.
B
20
S
5
G
6
Posts: 32
Reputation: 2,769

Post » Sat Mar 08, 2014 8:13 am

I suspect through some reading, that Javascript uses the browser's implementation of PRNG.
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Sun Mar 09, 2014 10:25 pm

Looking in C2's exporters directory I found that yes, javascript's Math.random() is used for random. But the algorithm used is left up to the browser's javascript engine as per the Javascript spec. However generally from what I found they all use Linear congruential generators. But I didn't bother to look further to see if anything has changed with newer browsers.
B
91
S
31
G
103
Posts: 5,234
Reputation: 67,754


Return to Construct 2 General

Who is online

Users browsing this forum: Colludium, jefftrier and 3 guests