1-
21<!DOCTYPE html>
32< html lang ="en ">
43
3837
3938 textarea {
4039 margin-top : 20px ;
41- width : calc (100% - 20px ); /* Adjusted width */
40+ width : calc (100% - 20px );
4241 height : 400px ;
4342 font-size : 16px ;
4443 resize : none;
5150 }
5251
5352 input [type = "text" ] {
54- width : calc (100% - 20px ); /* Adjusted width */
53+ width : calc (100% - 20px );
5554 padding : 10px ;
5655 font-size : 16px ;
5756 border : none;
6160 margin-top : 20px ;
6261 }
6362
64- textarea ::-webkit-scrollbar {
65- width : 8px ;
66- }
67-
68- textarea ::-webkit-scrollbar-track {
69- background : # 1e1e1e ;
70- border-radius : 5px ;
71- }
72-
73- textarea ::-webkit-scrollbar-thumb {
74- background : # 007bff ;
75- border-radius : 5px ;
76- }
77-
78- textarea ::-webkit-scrollbar-thumb : hover {
79- background : # 0056b3 ;
80- }
81-
8263 button {
8364 margin-top : 10px ;
8465 padding : 10px 20px ;
@@ -213,9 +194,13 @@ <h3 class="mb-4">Paste > V2rayN > Ctrl+A > Ctrl+R > Sort by result!</h3>
213194 return [ start , start + max - 1 ] ;
214195 }
215196
216- function getRandomIPFromCIDR ( cidr ) {
197+ function getRandomIPFromCIDR ( cidr , usedIPs ) {
217198 const [ start , end ] = cidrToRange ( cidr ) ;
218- const randomIP = Math . floor ( Math . random ( ) * ( end - start + 1 ) ) + start ;
199+ let randomIP ;
200+ do {
201+ randomIP = Math . floor ( Math . random ( ) * ( end - start + 1 ) ) + start ;
202+ } while ( usedIPs . has ( convertIPToString ( randomIP ) ) ) ;
203+ usedIPs . add ( convertIPToString ( randomIP ) ) ;
219204 return convertIPToString ( randomIP ) ;
220205 }
221206
@@ -241,9 +226,10 @@ <h3 class="mb-4">Paste > V2rayN > Ctrl+A > Ctrl+R > Sort by result!</h3>
241226 }
242227
243228 let results = [ ] ;
229+ let usedIPs = new Set ( ) ; // To track unique IPs
244230 for ( let i = 0 ; i < count ; i ++ ) {
245231 const randomCIDR = cidrList [ Math . floor ( Math . random ( ) * cidrList . length ) ] ;
246- results . push ( replaceIPInConfig ( inputConfig , getRandomIPFromCIDR ( randomCIDR ) ) ) ;
232+ results . push ( replaceIPInConfig ( inputConfig , getRandomIPFromCIDR ( randomCIDR , usedIPs ) ) ) ;
247233 }
248234 resultTextarea . value = results . join ( '' ) ;
249235 }
0 commit comments