This commit is contained in:
@ -2,8 +2,9 @@
|
||||
* Generate a random MAC address
|
||||
*/
|
||||
export function randomMacAddress(prefix: string | undefined): string {
|
||||
prefix = prefix ?? "";
|
||||
let mac = "XX:XX:XX:XX:XX:XX";
|
||||
mac = prefix + mac.slice(prefix?.length);
|
||||
mac = prefix + mac.slice(prefix.length);
|
||||
|
||||
return mac.replace(/X/g, () =>
|
||||
"0123456789abcdef".charAt(Math.floor(Math.random() * 16))
|
||||
|
Reference in New Issue
Block a user