I apologize for not knowing the correct terminology of what the algorithm is that I want. I'm looking for a bit of code preferably adaptable to C/C++. Perhaps this question has been answered and "random" is just too broad a topic to find specifically what I want.
Ages ago I had code in an assembly routine that returned a 16 bit value that appeared random. What it did was return all 64K values in a seemingly random order without ever repeating one. It was very small, and very fast. I used it to do things like create a screen dissolve. The same 64K pattern would always be returned. For me, this was better than a random generator where I would likely get the same values many times before every possible value had been returned.
The original code was from a Dr. Dobbs Journal of Computer Calisthenics and Orthodontia, probably around 1984 and I don't recall the original language. I think the code may actually have been something like a pink noise generator which I believe uses similar simple math and shifts but I haven't found code for one to verify and haven't followed the math I've seen. I'm not sure if pink or other noise generators repeat or if they repeat at a different frequency than the range of values returned. But anything similar for 16, 24, or 32 bit numbers would be great.
Aucun commentaire:
Enregistrer un commentaire