# File Name: random_number_histogram.R
# Author: Gerard King - www.gerardking.dev
# Title: Random Number Generator and Histogram Plot
# Description: This R program generates a random sample of numbers, calculates their mean,
# and plots the numbers in a histogram. It includes annotations for both the mean value
# and the generated data.
# Use Cases:
# - Data visualization for data analysis
# - Statistical analysis of random distributions
# - Simulating random data for educational purposes
# Audience:
# - Data analysts
# - Students learning statistics
# - Security professionals in blue and red teams
# Blue Team Uses:
# - Visualizing data trends for monitoring system behavior
# - Understanding randomness in system logs and patterns
# - Analyzing network or system anomalies using statistical methods
# Red Team Uses:
# - Testing randomness of attack simulations
# - Generating random data for penetration testing or simulation scenarios
# - Analyzing unpredictable data patterns during a test or breach simulation
# Current Date: 2025-03-06
# Set the seed for reproducibility
set.seed(123)
# Generate a random sample of 100 numbers from a normal distribution
random_numbers <- rnorm(100)
# Create a simple histogram of the random numbers
hist(random_numbers, main="Histogram of Random Numbers - Gerard King",
xlab="Value", ylab="Frequency", col="skyblue", border="black")
# Add a line showing the mean of the data
abline(v=mean(random_numbers), col="red", lwd=2, lty=2)
# Display the mean value in the console
cat("Mean of the generated random numbers:", mean(random_numbers), "\n")
# Print the current date for reference
cat("Date of execution:", Sys.Date(), "\n")