# Questions tagged [random-generation]

The act of generating a sequence of numbers or symbols randomly, or (almost always) pseudo-randomly; i.e., with lack of any predictability or pattern.

634
questions

**0**

votes

**0**answers

23 views

### What is the legitimacy of Gaming Labs Certified? [closed]

I saw two poker engines that claim to have an RNG Certificate of Integrity from a company called Gaming Labs.
Is this Gaming Labs a known respected authority?
This is a follow up question since ...

**1**

vote

**0**answers

11 views

### How to improve pseudo-random number generation by large truly random data?

Question
Say I have access to a relatively large (but not huge) amount of truly random data, D, like 100 KiB of random bits from a hardware randomness source (just ...

**1**

vote

**1**answer

58 views

### inverse transform method [closed]

Using Inverse Transform Method to solve parts of the problem below:
(a) Suppose $X \sim \text{Exponential}(λ = 0.2)$. Use RN to generate
20 random realisations of $X$ $\{X_1, X_2, .., X_{20}\}$ ...

**0**

votes

**1**answer

34 views

### Random number generator independence

I have a naïve question about random number generators.
Say I want to generate a set of random variables from different exponential distributions,$$X_i \sim \mathcal {Exp}(\lambda_i)$$ Assume the$X_i$'...

**2**

votes

**1**answer

177 views

### Does runif (R) ever return 0/1 [closed]

The title says it all. Can it happen that runif (with bounds 0 and 1) returns 0 or 1 in R?

**0**

votes

**0**answers

12 views

### how to generate joint random variables given knowledge of marginal density and copula function? [duplicate]

Suppose I know that $X\sim F_{X}(\cdot)$, $Y\sim F_{Y}(\cdot)$, and know their copula function $C(\cdot,\cdot)$ such that $F_{X,Y}(x,y)=C(F_{X}(x),F_{Y}(y))$. How to draw $\{X_{i},Y_{i}\}_{i=1}^{n}$ ...

**5**

votes

**2**answers

438 views

### Does rnorm produce numbers with replacement/without replacement?

rnorm is an R language function defined as:
rnorm.X generates multivariate normal random variates in the space X.
Consider <...

**2**

votes

**1**answer

27 views

### Understanding the Rejection Sampling for a vector

I am thinking about this classical problem in statistical simulations. We want to apply the Rejection sampling to simulate a random vector $Y=(Y_1, Y_2)$ of a uniform distribution from a unit disc $D =...

**8**

votes

**0**answers

74 views

### Is there a continuous function that accepts a single uniform random variable and returns two independent uniform random variables?

I can define a function $f(X) = (Y_1,Y_2)$ that accepts a random variable $X$ with a uniform distribution on $[0,1]$, and returns two independent uniform random variables $Y_1,Y_2$. This function ...

**5**

votes

**1**answer

60 views

### Seeking an intuitive understanding of independence for random variables

I'm trying to gain a deeper, more intuitive understanding of what it means for two random variables $X$ and $Y$ to be independent. From my statistics courses, I know that $X$ and $Y$ are independent ...

**1**

vote

**0**answers

28 views

### How can I generate a dataset to test variable importance calculations?

I would like to generate random data that has predetermined variable importance, so that I can test out different methods of calculating variable importance and see how they perform vs. the ...

**4**

votes

**1**answer

39 views

### How do I generate a generalised error random variable?

The generalised error distribution (sometimes called the generalised normal distribution) is a generalisation of the normal distribution allowing variation of the kurtosis away from mesokurtosis. ...

**9**

votes

**1**answer

356 views

### @whuber 's generation of a random variable with fixed covariance structure

The question refers to @whuber's algorithm to draw a random variable with a given covariance structure to a given set of random variables: http://ucslk.com/a/313138/3277
The algorithm ...

**21**

votes

**7**answers

3k views

### How to generate random integers between 1 and 4 that have a specific mean?

I need to generate 100 random integers in R, where each integer is between 1 and 4 (hence 1,2,3,4) and the mean is equal to a specific value.
If I draw random ...

**3**

votes

**1**answer

65 views

### Generating pairs of random variables with given covariance and gamma marginals

I have shape parameters $k_X, k_Y$ and scale parameters $\theta_X, \theta_Y$, as well as a covariance $\sigma_{XY}$.
How do I generate random variables $(X,Y)$ such that the marginals are gamma ...

**0**

votes

**0**answers

11 views

### How to estimate population size from repetition in random sampling? [duplicate]

I'm periodically sampling values from what's likely a large population. Millions, let's say. And I'm assuming initially that it's random sampling.
However, it's only workable to collect thousands of ...

**1**

vote

**2**answers

29 views

### How generate random data that satisfy specific constraints such as having specific median? in R [closed]

In general, how can I simulate data that exactly satisfies a set of constraints? I'm in need of generating a set of random numbers, which conform to a given median (not mean), and also fall within ...

**4**

votes

**2**answers

80 views

### Is there a way to visualize the limited randomness of an algorithm?

Take the R runif function for example.
It sure is a very performing pseudo-random generator. Even if I don't really know what it means I think I read somewhere ...

**1**

vote

**3**answers

70 views

### How to generate a vector that has zero correlation with another vector (in R)?

Suppose I have a vector v1 with values in the set {-1,0,1}
...

**1**

vote

**0**answers

37 views

### Inversion sampling for a truncated normal distribution?

I'm a bit unsure how to approach this problem given that the normal CDF has no closed form solution.
Let $f(x|\mu,\sigma,c)$ be a normal distribution left-truncated at
$c$, so that
$$f(x|\mu,\...

**1**

vote

**1**answer

83 views

### How can I create meaningful / interesing data following multiple linear models?

I would like to create many(!) examples for exercices, where I would like to control various parameters such as the coefficients, their uncertainty, t-values and p-values of the linear model.
I know, ...

**6**

votes

**2**answers

108 views

### Understanding glm and link functions: how to generate data?

I'm trying to take the approach for understanding how certain concepts work, by trying to generate data for them and checking how the output behaves. Currently, I thus realized I don't quite get what'...

**5**

votes

**1**answer

133 views

### Is there such a thing as a “good/bad” seed in pseudo-random number generation?

Well, I don't really have much to add to the title. I tend not to use seeds in preudo-random number generation, but they are handy when an initial research project that includes simulations expands to ...

**0**

votes

**2**answers

35 views

### Is there a code/ software that generates random numbers? My specific interest - from Dirichlet distribution [closed]

Is there a code/ software that generates random numbers? My specific interest - from Dirichlet distribution. Lets say, x1,x2,...x8 and 1000 random instances of it with a uniform alpha=2.

**2**

votes

**1**answer

42 views

### How to generate data such that an equation needs to hold?

Can I create or generate $\{y_i\}_{i=1}^{4}$ data set such that this equation holds
$$
\sum_{i=1}^{4}\sum_{j=1}^{4}m_{ij}y_{i}y_{j}=6
$$
where
$$
m=\left[
\begin{array}{cccc}
13 & 12 & 3 &...

**0**

votes

**1**answer

57 views

### How to generate artificial data to have a similar results after doing an OLS estimation?

I am trying to replicate a paper that the data are confidential, however, for the sake of practice in coding and performing similar analysis, I am trying to generate artificial data so that after I ...

**0**

votes

**0**answers

124 views

### Generating skew-normal distribution in Matlab

My apologies if this is a trivial question, but I am having trouble with this for a while now.
I need to use a skew-normal distribution in research in MATLAB and the only way I found after googling ...

**12**

votes

**2**answers

195 views

### Why is pseudo-random sampling applicable for Monte Carlo integration, even though it does not satisfy the CLT requirements?

Assume we have a function $f\left(x\right)$ defined on $\left[0, 1\right]$ that we want to integrate and estimate the error using Monte Carlo method. We generate realizations of uniformly distributed ...

**0**

votes

**0**answers

23 views

### Setting seeds despite repeated training of CNNs?

I would like to compare the classification performance (like accuracy, precision, recall etc.) of different CNN architectures. I'm using Google Colab (GPU support), Tensorflow and Keras.
Since it is ...

**2**

votes

**4**answers

138 views

### which is the meaning of scatterplot between a pair of 2 consecutive pseudo random numbers with respect to the independence of the sequence?

Pseudo random number generators should give as output random sequences u1, u2, ... that are mutually independent and identically distribuited (iid).
Since testing for independence is not easy, the ...

**0**

votes

**2**answers

36 views

### check for noncorrelation of normal pseudo random numbers using scatterplot

pseudo random number generators should give as output random sequences u1, u2, ... that are independent and identically distribuited (iid).
Since testing for independence is not easy, the first check ...

**1**

vote

**1**answer

26 views

### Why is the exprected value of a sum of RV following a Z-distribution not equalt to 0?

I am using R to draw a thousand of RVs from a Z-distribution.
I noticed that the expected value of their mean is as expected ~0 (magnitude 10^(-4)) sometimes positive, sometimes negative but; the sum ...

**0**

votes

**1**answer

157 views

### Why is weighing random observations according to their probability from all distributions wrong?

Is sampling all distributions n times and then talking out i numbers from each sample, where i is probability of that distribution * n, wrong?
Suppose $$
0.3\!\times\mathcal{N}(0,1)\; + \;0.5\!\...

**1**

vote

**1**answer

41 views

### How to generate random samples from a 2D dataset?

Suppose I'm given a data set consisting of many pairs of $(x,y)$ values which are correlated in some arbitrary complex way. How would I go about 'generating' more pairs of $(x,y)$ coordinates which ...

**2**

votes

**0**answers

14 views

### Simulate Data for Power of Random Intercepts Model

I am interested in calculating the power of a cluster randomized clinical trial of a binary intervention ($T$=1 for treated and $T$=0 for control). I have a pretty set number of candidate clusters ...

**2**

votes

**2**answers

105 views

### How to generate a uniform random variable from [1,7] if given a uniform[1,5] RV generator? [duplicate]

I saw this as a question on glassdoor and I've seen similar questions elsewhere. Can someone explain the intuition of how to solve a problem like this? There are two scenarios
The uniform RVs in ...

**0**

votes

**1**answer

103 views

### Is there a way to generate artificial data from clusters?

Suppose you have a data set that can be clustered as follows:
Is there a way to generate data that would fit inside, say, the red bubble, or blue bubble? This can definitely be done in two-dimensions,...

**0**

votes

**0**answers

20 views

### Simulate cell missingness for a certain proportion of cells in a full data set

I know there was a question asked a few years back about simulating missingness.
The original thread link is here How to simulate the different types of missing data
Since then, there has been a ...

**0**

votes

**0**answers

17 views

### Correct method for error propagation in pseudo-data approach (simulation) using model

I want to compute the error on the integral over experimental data $(y_i,\delta y_i)$ in a pseudo-data approach using model ($x_i$ are assumed to be known error-less numbers).
If I were using direct ...

**1**

vote

**0**answers

20 views

### how to do re-randomization test for trials used adaptive minimization with unequal allocation?

Re-randomization test is often chosen to validate the results from a study was randomized by adaptive minimization. In the case of of unequal allocation (like 2:1), it is more complicated because the ...

**1**

vote

**2**answers

38 views

### What is the name of this simple discrete sampling algorithm?

I have a vector of probabilities $p \in \mathbb{R}^n$ which I have never seen before. I would like a single sample from the indices $(1, 2, \ldots n)$ according to the distribution defined by $p$. ...

**0**

votes

**1**answer

40 views

### Generating random values from a multivariate skew-normal with fixed marginals

I'm generating random values from the multivariate skew-normal, and I want that the marginal distributions from this multivariate one have fixed parameters as the following:
I'm generating from ...

**0**

votes

**2**answers

75 views

### how to generate random data based on simple statistical meassures

0
I currently have a test data set that has 500k data points. I have an algorithm that process that data and returns some information. In order to establish the statistical significance of the ...

**0**

votes

**0**answers

14 views

### Random variates generation for disrecte distribution by inverse transform method [duplicate]

I have solved this question but still confused. I don't know whether this method is correct or not and also the answer which I get is right or wrong, as I was told to generate random variates for ...

**0**

votes

**2**answers

37 views

### Does rowwise distribution of random values in creating a normally distributed vector variable in matrix(rnorm(.), byrow=TRUE) damage normality?

(Reprodicible example added) 150-character-limitless full question is:
Does the rowwise distribution of values in creating a normally distributed vector variable via ...

**1**

vote

**1**answer

477 views

### Gamma Distribution for generating random numbers

I defined a gamma distribution with following parameters: shape,scale = 4.2503, 7037. This dribuation is used to generate random numbers. The random numbers will be recalculated to the x-asix value.
...

**0**

votes

**1**answer

74 views

### How to use poisson to estimate arrival time (generate random integers)?

In my assignment, I'm supposed to use a distribution curve to describe how many minutes will the employee come to work in advanced or later than the planed start time.
I decided to use Poisson ...

**1**

vote

**0**answers

42 views

### Generating new(fake) probability distributions based on many sample probabilty distributions

I wish to be able to generate new probability distributions that incorporate the characteristics of many sample distributions available to me.
I currently have data for the individual daily return ...

**0**

votes

**0**answers

34 views

### How to Incorporate Skew Into Simulated Data?

Suppose I have a dataset $\mathbf{X}$ which is a $n \times m$ matrix of $n$ independent realizations of some $m$-dimensional random vector $\mathbf{x}$. I want to generate a new dataset $\mathbf{X}'$ ...

**4**

votes

**1**answer

83 views

### Transforming a uniform random variate to points on a circle

Sample $U \sim \text{Uniform}(0,\sqrt{2}-1)$. Accept $U$ with probability $1/(1+U^2)$ (else reject and sample again). Set $X = 2U/(1+U^2)$ and $Y = 1-UX = (1-U^2)/(1+U^2)$. With probability 1/2, ...