ObjFW  Diff

Differences From Artifact [3f9a87cf9e]:

To Artifact [cec5f5d20d]:


27
28
29
30
31
32
33


34
35
36
37
38
39
40
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>



#include "platform.h"

#ifdef OF_OBJFW_RUNTIME
# ifdef OF_COMPILING_OBJFW
#  import "ObjFW_RT.h"
# else
#  import <ObjFW_RT/ObjFW_RT.h>







>
>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <sys/time.h>

#include "platform.h"

#ifdef OF_OBJFW_RUNTIME
# ifdef OF_COMPILING_OBJFW
#  import "ObjFW_RT.h"
# else
#  import <ObjFW_RT/ObjFW_RT.h>
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
#if defined(OF_HAVE_ARC4RANDOM)
	return arc4random();
#elif defined(OF_HAVE_RANDOM)
	struct timeval tv;

	gettimeofday(&tv, NULL);
	srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
	return (((uint32_t)(random()) << 16) | ((uint32_t)(random()) & 0xFFFF);
#else
	struct timeval tv;

	gettimeofday(&tv, NULL);
	srand((unsigned)(t.tv_sec ^ t.tv_usec));
	return (((uint32_t)(rand()) << 16) | ((uint32_t)(rand()) & 0xFFFF);
#endif
}







|





|


857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
#if defined(OF_HAVE_ARC4RANDOM)
	return arc4random();
#elif defined(OF_HAVE_RANDOM)
	struct timeval tv;

	gettimeofday(&tv, NULL);
	srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
	return (((uint32_t)(random()) << 16) | ((uint32_t)(random()) & 0xFFFF));
#else
	struct timeval tv;

	gettimeofday(&tv, NULL);
	srand((unsigned)(t.tv_sec ^ t.tv_usec));
	return (((uint32_t)(rand()) << 16) | ((uint32_t)(rand()) & 0xFFFF));
#endif
}