Accedi per salvare i tuoi progressi e guadagnare punti!
RNGs: An AS3 approach (Random Number Generators)

RNGs: An AS3 approach (Random Number Generators)

di DogGonMad

Loading ad...

RNGs: An AS3 approach (Random Number Generators)

Voto:
2.6
Rilasciato: June 25, 2011
Ultimo aggiornamento: June 25, 2011
Sviluppatore: DogGonMad

Tag per RNGs: An AS3 approach (Random Number Generators)

Descrizione

A tutorial on RNGs developed over the years.
To be updated and expanded (Please notify me of any errors)

Commenti

0/1000
omkara avatar

omkara

Jun. 25, 2011

2
3

I am not saying that you did wrong or right. I am leaving this conclusion on you.
I don't want to invent the wheel again.
When it is invented, there is a huge set of math function who is the fu*ker will read and use this epic on RNG.
This is so basicccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

DogGonMad avatar

DogGonMad

Jun. 25, 2011

0
0

honza, thanks for pointing out my mistake on the >>> shift.

DogGonMad avatar

DogGonMad

Jun. 25, 2011

0
0

honnza: I do not consider myself an expert in this field, but that is the formula for a LCG, whether or not something is wrong due to my lack of understanding of AVM2 or otherwise, it functions as intended. AVM2 does have it's drawbacks, such as what should be, in fact a uint, is a int, and occasionally a number is the use of the atom number format and not truly having all 32 bits for use.

DogGonMad avatar

DogGonMad

Jun. 25, 2011

0
0

partial cp from pm to honnza:
Thanks for bashing the tut. But do you realize that Flash runs on a virtual machine and the mxmlc compiler is horrible at optimizing code? Thatโ€™s one of the best things I like about it. it makes you write not only better code, but also more efficient code. Flash is horrible at many operations as it promotes things to Numbers (32bit Floating-point) and then converts back to the initial data type. and also notice that because we are using a power of two with the & operator, there is no problem (And there is no reason for having m as less than what it is, if you want fewer bits, simply take the higher order bits.

honnza avatar

honnza

Jun. 25, 2011

0
0

Ad inlining: is the platform really _that_ bad, unable to inline function calls AND lacking any sort of macro facility? At the very least, you should store your "magic constants" at one place and only refer to them from your code (even if the compiler cannot optimize that - which I doubt - the CPU certainly can. Actually, it may be even faster (smaller source code -> less cache misses). Also, the (2^32) constant should be expressed like that, or at least in hexadecimal - it's not obvious from the decimal form that it's a power of two; see m