0
0
This commit is contained in:
Guy Baconniere
2021-08-20 10:02:38 +02:00
parent 5aa02c94b5
commit d30270c485
354 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rand_string.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tkondrac <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/08 12:07:16 by tkondrac #+# #+# */
/* Updated: 2021/08/08 13:04:23 by tkondrac ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
char *rand_string(unsigned int size)
{
char *c;
unsigned int i;
c = (char*)malloc(size * sizeof(char));
i = 0;
srand(time(0));
while(i < size - 1)
{
*(c + i) = (rand() % 94) + 32;
i++;
}
*(c + i) = '\0';
return (c);
}