$OpenBSD: patch-tools_flow6_c,v 1.1 2013/09/26 21:52:35 bluhm Exp $
--- tools/flow6.c.orig	Fri Aug 16 07:35:41 2013
+++ tools/flow6.c	Sun Sep  8 20:49:58 2013
@@ -227,8 +227,7 @@ int main(int argc, char **argv){
 	}
 
 
-	srandom(time(NULL));
-	hoplimit=64+random()%180;
+	hoplimit=64+arc4random_uniform(180);
 	init_iface_data(&idata);
 
 	while((r=getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
@@ -536,9 +535,9 @@ int main(int argc, char **argv){
 		puts("Identifying the 'Flow ID' generation policy of the target node....");
 
 		if(protocol == IPPROTO_TCP){
-			tcpwin= ((u_int16_t) random() + 1500) & (u_int16_t)0x7f00;
-			tcpseq= random();
-			baseport= 50000+ random()%10000;
+			tcpwin= ((u_int16_t) arc4random() + 1500) & (u_int16_t)0x7f00;
+			tcpseq= arc4random();
+			baseport= 50000+ arc4random_uniform(10000);
 			lastport= baseport;
 		}
 
@@ -585,8 +584,8 @@ int main(int argc, char **argv){
 
 			if( testtype==FIXED_ORIGIN && ((curtime - start) >= ID_ASSESS_TIMEOUT || ntest1 >= NSAMPLES)){
 				testtype= MULTI_ORIGIN;
-				addr_sig= random();
-				addr_key= random();
+				addr_sig= arc4random();
+				addr_key= arc4random();
 				start= curtime;
 				continue;
 			}
@@ -1173,7 +1172,7 @@ void randomize_ipv6_addr(struct in6_addr *ipv6addr, st
 		ipv6addr->s6_addr16[i]= 0;
 
 	for(i=startrand; i<8; i++)
-		ipv6addr->s6_addr16[i]=random();
+		ipv6addr->s6_addr16[i]=arc4random();
 
 	if(preflen%16){
 		mask=0xffff;
@@ -1198,8 +1197,7 @@ void randomize_ipv6_addr(struct in6_addr *ipv6addr, st
  */
 
 void randomize_ether_addr(struct ether_addr *ethaddr){
-	for(i=0; i<6; i++)
-		ethaddr->a[i]= random();
+	arc4random_buf(ethaddr, sizeof(struct ether_addr));
 
 	ethaddr->a[0]= (ethaddr->a[0] & 0xfc) | 0x02;
 }
