< index < 9. Pseudorandom number generator < 9.2 Using a generator | ===================================== 9.3 Getting a random int from a byte array ===================================== | > 9.4 Destroying a generator

This is a very specific feature that may be useful in certain situations. Imagine you want the player to type a world name at the start of the game so that :
- typing the same name twice results in the same world
- typing different names results in different worlds
Obviously, you need to get a random seed from the name of the world in a determinist way. This is what this function does for you.
Note that this function is not a pseudorandom number generator, but a seed generator. You still have to create a generator from that seed.

    C++ : static int TCODRandom::getIntFromByteArray(int min, int max, const char *data,int len)
    C   : int TCOD_random_get_int_from_byte_array(int min, int max, const char *data,int len)
    Py  : random_get_int_from_byte_array(mi, ma, data)

Parameter | Description
--- | ---
min, max | When you call this function, you get a number between (including) min and max
data, len | The byte array. len is the number of significant bytes in the array. data may not be finished by a 0 character.

Example :

    C++ : // get a random int from a name
          char *name = ... get a name
          int aRandomIntBetween0And1000 = TCODRandom::getIntFromByteArray(0,1000,name,(int)strlen(name));
          // get a random int from another int
          int myInt = ...
          int aRandomInt = TCODRandom::getIntFromByteArray(0,1000,&myInt,sizeof(int));
    C   : /* get a random int from a name */
          char *name = ... get a name
          int a_random_int_between_0_and_1000 = TCOD_random_get_int_from_byte_array(0,1000,name,(int)strlen(name));
          /* get a random int from another int */
          int my_int = ...
          int a_random_int = TCOD_random_get_int_from_byte_array(0,1000,&my_int,sizeof(int));
    Py  : # get a random int from a name
          name = ... get a name
          a_random_int_between_0_and_1000 = libtcod.random_get_int_from_byte_array(0,1000,name)
          # get a random int from another int
          my_int = ...
          a_random_int = libtcod.random_get_int_from_byte_array(0,1000,my_int)