Ever needed a random number generator that actually SEEMED random?
Ever needed to generate random strings, arrays, vectors, etc?
Ever really wanted a secure random salt generator for say, your MD5 or sockets plugin?
RandomX provides such functionality, and will soon provide even more.
RandomX uses a random number generator called the "Mersenne Twister", which is one of the fastest random number generators availible, and is light years ahead of the current ones implimented in AMXx. This means high quality and inexpensive randomized variables.
And, supposing anyone who codes for AMXx actually USES the sockets or MD5 functions, it has a higher cost, but more random, salt generator, useful for any hash or socket.
In addition, for anyone who wants a more randomized integer, float, or vector, the "iten" parameter will add another degree of randomness, at the cost of CPU. The higher the iten value, the more cycles the generator goes through to make your number, and thus the more random it is.
Functions:
Code: Select all
// Generates a bool value
native Bool:generate_bool();
// Generates an integer between lower and upper, cycles iten times.
native generate_int(lower = 0,upper = CELL_MAX,iten = 1)
// Generates a float between lower and upper, cycles iten times.
native Float:generate_float(Float:lower = 0.0,Float:upper = FLOAT_MAX ,iten = 1)
// Generates a vector between lower and upper, cycles iten times.
native generate_vector(Float:vec[3],Float:lower = 0.0,Float:upper = FLOAT_MAX,iten = 1);
// Generates a randomized string, not garanteed to fill the entire len.
native generate_string(output[],len)
// Generates an alpha numberical string, garanteed to fill the entire len
native generate_alpha_string(output[],len)
// Generates a highly random salt.
native generate_salt(salt_value[], len = 34)
// Generates a randomized value for each index of given array.
native generate_array(output[],len)Code: Select all
// Returns the index of a new random number generator. Default seed is randomized based on global random number generator.
native new_generator(seed[]= {0,...})
// Records state of given generator, so you can recreate it later
native record_generator(gen_id,str[],len)
// Loads state into a new generator.
native load_generator(str[],len)
// Seeds a generator with new values
// seed_generator(gen_id,seed[] = {0,...})
All current natives will have another parameter added on the end for usage with custom generators.MTRand class highly altered by me, and Generator class created and maintained by me, for exclusive use with AMXx (not really needed anywhere else)
This could be very easily inserted into AMXx and used for many of its functions, but it probably won't be, as its not a terribly needed feature.
