Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sample

Sample random addresses


Description

sample_ipv4() and sample_ipv6() sample from the entire address space; sample_network() samples from a specific network.

Usage

sample_ipv4(size, replace = FALSE)

sample_ipv6(size, replace = FALSE)

sample_network(x, size, replace = FALSE)

Arguments

size

Integer specifying the number of addresses to return

replace

Should sampling be with replacement?

x

An ip_network scalar

Value

An ip_address vector

See Also

Use seq.ip_network() to generate all addresses in a network.

Examples

sample_ipv4(5)

sample_ipv6(5)

sample_network(ip_network("192.168.0.0/16"), 5)

sample_network(ip_network("2001:db8::/48"), 5)

ipaddress

Tidy IP Addresses

v0.5.1
MIT + file LICENSE
Authors
David Hall [aut, cre] (<https://orcid.org/0000-0002-2193-0480>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.