Constructs Random - A quick example

Post your own tutorials, guides and demos.

Post » Tue Jan 13, 2009 11:17 am

For anyone worried that the construct random might be badly made because its built in, or doesn't produce good random value, or is bias to higher ranges or something, this should hopefully prove them wrong :) Construct uses the mersenne twister algorithm
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Jan 14, 2009 4:05 am

YES!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SMILEY RACING! :D :D :D :D :D :D :D :D
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Wed Jan 14, 2009 11:45 am

Is it possible to set the seed for the random number generator? That kind of thing can be pretty useful, especially if you're doing procedurally generated stuff.
B
2
S
1
G
5
Posts: 59
Reputation: 1,518

Post » Wed Jan 14, 2009 2:31 pm

what would a seed do? random is random (i think... :) )
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Wed Jan 14, 2009 2:50 pm

Seed would provide you with repeatable random sequences which would be of use when creating replays of game (so that you won't have to store all random moving objects position but only seed that'd reprocude all their movement correctly).
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Wed Jan 14, 2009 3:17 pm

[quote="Davioware":4sizl3t9]what would a seed do? random is random (i think... :) )[/quote:4sizl3t9]

Computer generated random numbers aren't truly random and are generated using an algorithm (there are lots of different methods), but that algorithm needs a starting number to generate all the others from. If you put in the same seed number, you'll get the same results each time, so often people use the current time in milliseconds to seed the generator so that it appears different each time. However, like Broo said, it can be useful to set the seed number, especially if you want everything to happen as it did the first time like in replays for example.
B
2
S
1
G
5
Posts: 59
Reputation: 1,518

Post » Sat Jan 17, 2009 4:56 pm

off topic, but how did you manage to put an expression into the 'set color filter' action? it defaults to a colorpicker ...
B
2
S
2
G
4
Posts: 171
Reputation: 1,792

Post » Sat Jan 17, 2009 6:59 pm

[quote="dkdoom":qv7vfst5]off topic, but how did you manage to put an expression into the 'set color filter' action? it defaults to a colorpicker ...[/quote:qv7vfst5]

After you've chosen "Set colour filter" as the action, right click where it says "Filter", and you can choose to use an expression from the menu that appears.
B
2
S
1
G
5
Posts: 59
Reputation: 1,518

Post » Sat Jan 17, 2009 11:18 pm

[quote="BenH":3e9yh99b][quote="dkdoom":3e9yh99b]off topic, but how did you manage to put an expression into the 'set color filter' action? it defaults to a colorpicker ...[/quote:3e9yh99b]

After you've chosen "Set colour filter" as the action, right click where it says "Filter", and you can choose to use an expression from the menu that appears.[/quote:3e9yh99b]


Right click?

So that's how you do it. I was having trouble with that the other day.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Jan 17, 2009 11:31 pm

It IS pretty confusing... It isn't generally very good UI design to hide features EXCLUSIVELY inside context menus... There could be some kind of VISIBLE hint?
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests