Skip to content
Extraits de code Groupes Projets
Valider 2d7201cf rédigé par Louis Navarre's avatar Louis Navarre
Parcourir les fichiers

Add tinymt32 example

parent fcfa2d9f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -8,6 +8,7 @@
#include <limits.h>
#include <inttypes.h>
#include <stdbool.h>
#include "headers/tinymt32.h"
typedef struct
{
......@@ -138,6 +139,22 @@ int main(int argc, char *argv[])
}
// TODO: parse the input binary file, decode the encoded message with RLC and write the output in the output stream following the statement
// You may modify or delete the following lines. This is just an example of how to use tinymt32
uint32_t seed = 42; // Replace with the seed from the instance file!
tinymt32_t prng;
memset(&prng, 0, sizeof(tinymt32_t));
// Do not modify these values!
prng.mat1 = 0x8f7011ee;
prng.mat2 = 0xfc78ff1f;
prng.tmat = 0x3793fdff;
tinymt32_init(&prng, seed);
// You can generate coefficients by calling this function
// Do not forget that we use byte values, so we have to
// cast the uint32_t returned value to only keep the last 8 bits.
uint8_t coef = (uint8_t)tinymt32_generate_uint32(&prng);
// Close this instance file
fclose(input_file);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter