comparison mcabber/mcabber/xmpp.c @ 1746:b7574de9ae4b

Use random() instead of rand() (As recommended in the manpage...)
author Mikael Berthe <mikael@lilotux.net>
date Thu, 11 Mar 2010 21:53:46 +0100
parents a9b0364c0cb2
children c4f67e2e675f
comparison
equal deleted inserted replaced
1745:5ef7629a96ff 1746:b7574de9ae4b
1710 if (!settings_opt_get("disable_random_resource")) { 1710 if (!settings_opt_get("disable_random_resource")) {
1711 #if HAVE_ARC4RANDOM 1711 #if HAVE_ARC4RANDOM
1712 dynresource = g_strdup_printf("%s.%08x", resource, arc4random()); 1712 dynresource = g_strdup_printf("%s.%08x", resource, arc4random());
1713 #else 1713 #else
1714 unsigned int tab[2]; 1714 unsigned int tab[2];
1715 srand(time(NULL)); 1715 srandom(time(NULL));
1716 tab[0] = (unsigned int) (0xffff * (rand() / (RAND_MAX + 1.0))); 1716 tab[0] = (unsigned int) (0xffff * (random() / (RAND_MAX + 1.0)));
1717 tab[1] = (unsigned int) (0xffff * (rand() / (RAND_MAX + 1.0))); 1717 tab[1] = (unsigned int) (0xffff * (random() / (RAND_MAX + 1.0)));
1718 dynresource = g_strdup_printf("%s.%04x%04x", resource, tab[0], tab[1]); 1718 dynresource = g_strdup_printf("%s.%04x%04x", resource, tab[0], tab[1]);
1719 #endif 1719 #endif
1720 resource = dynresource; 1720 resource = dynresource;
1721 } 1721 }
1722 1722