bitburner-src/utils/IPAddress.ts

19 lines
362 B
TypeScript
Raw Normal View History

2021-09-04 19:09:30 -04:00
import { getRandomByte } from "./helpers/getRandomByte";
2019-03-02 19:15:10 -08:00
/**
* Generate a random IP address
* Does not check to see if the IP already exists in the game
*/
2019-03-02 19:15:10 -08:00
export function createRandomIp(): string {
2021-09-04 19:09:30 -04:00
const ip: string =
getRandomByte(99) +
"." +
getRandomByte(9) +
"." +
getRandomByte(9) +
"." +
getRandomByte(9);
2019-03-02 19:15:10 -08:00
2021-09-04 19:09:30 -04:00
return ip;
2019-03-02 19:15:10 -08:00
}