I think you're asking how to simulate the arrivals time of a Poission process with a given lambda. The time between arrivals in a Poisson process is given by the exponential distribution, so if you want to model x consecutive arrival times of a Poisson process with lamba = 5, you would just do:
cumsum(rexp(x, lambda))
So, for example, suppose I want to model a Poisson arrivals process based on existing Poisson data that I have. (I don't so I'll create a random sample):
set.seed(69)
existing_poisson_data <- rpois(50, 5)
existing_poisson_data
#> [1] 5 7 6 7 4 8 3 7 3 1 8 4 8 3 3 3 2 6 2 7 4 3 6 4 3 3 6
#> [28] 6 2 4 6 8 4 5 4 6 6 5 4 5 11 4 5 6 3 1 2 3 4 3
I want to simulate the arrivals time for a Poisson process with the same lambda and the same number of arrivals. I can therefore do this:
number_of_arrivals <- sum(existing_poisson_data)
lambda <- mean(existing_poisson_data)
simulated_time_diffs <- rexp(number_of_arrivals, lambda)
arrivals <- cumsum(simulated_time_diffs)
Now we can see whether our arrivals match a Poisson distribution:
simulated_histogram <- hist(arrivals, breaks = 0:ceiling(max(arrivals)))

This looks fine. If the counts are actually Poisson distributed, their mean should be about the same as their variance:
mean(simulated_histogram$counts)
#> [1] 5.418605
var(simulated_histogram$counts)
#> [1] 5.487265
You don't need a dispersion test to see that these data seem to be Poisson distributed. So now you can safely use your arrivals
variable as a simulation of the arrival times of a Poisson process with a lambda of 5.
So, if you want to simulate n
arrivals for a Poisson process based on another Poisson process with a given lambda
and Bernoulli variable p
you would do
arrivals <- cumsum(rexp(n, p * lambda))
Alternatively, you could use your Bernoulli variable to sample out some of the arrivals like this:
arrivals <- arrivals[as.logical(rbinom(length(arrivals), 1, p))]