#' Knapsack data
#' A funtion that simulates data to the Knapsack problem.
#'
#'
#' @param n size of the data frame.
#' @param seed set seed of the simulated data.
#'
#' @return A dataframe with 2 variables and n rows.
#' @export
knapsack_data<-function(n=2000,seed=42){
set.seed(seed)
n <- n
knapsack_objects <-data.frame(
w=sample(1:4000, size = n, replace = TRUE),
v=stats::runif(n = n,0,10000)
)
return(knapsack_objects)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.