Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

campos20 May 20th, 2020 1,304 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. // Gera senha aleatoria
  6. // Autor Alexandre Campos
  7.  
  8. // Gera 1 numero aleatorio ate um limite
  9. int numero_aleatorio(int maximo)
  10. {
  11.     return random() % maximo;
  12. }
  13.  
  14. char gera_char_aleatorio()
  15. {
  16.    // Retorna aleatorio entre a e a+26 (sao 26 letras)
  17.     return 'a' + numero_aleatorio(26);
  18. }
  19.  
  20. int main()
  21. {
  22.     // Chamar 1 vez
  23.     srand(time(NULL));
  24.  
  25.     for (int i=0; i<100; i++)
  26.     {
  27.         char resultado = gera_char_aleatorio();
  28.         int codigo = resultado;
  29.         printf("Char: %c\n", resultado);
  30.     }
  31.     return 0;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top