4,047 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
4
votes
3
answers
171
views
Generator that yields True a fixed number of times at random intervals before exhausting
I want to iterate through a list of size n, with A 1s in it (the rest are 0s), and I want the 1s randomly distributed.
n and A are large, so I'm trying to make a generator instead of a list.
If they ...
0
votes
2
answers
113
views
What is an effective method to do a "reverse" Weighted RNG?
I'm working on designing an RNG loot table for something a friend is running, and the obvious solution given the nature of the loot table (its for a foraging system) is to use a weighted RNG method. ...
-4
votes
1
answer
98
views
Tensorflow GPU acceleration but not for Deep Learning tasks
I am a mathematician. I am doing some work on simulating probability distribution draws, but there are lots of calculations involved in terms of numerical integration, function inversion. All of this ...
0
votes
0
answers
69
views
1D Linear Value Noise Not Uniform Distribution; Is there a better noise function?
I have a simple 1D value noise function here:
public float ValueNoise1D(float x)
{
int l = Mathf.FloorToInt(x);
int r = l + 1;
float vl = hashToFloat(hash(l));
float vr = hashToFloat(...
1
vote
0
answers
71
views
log_prob for custom uniform distribution in PyTorch
When computing the dist.log_prob function for a uniform distribution on a box dist, the results seems to be -inf for the coordinates that are out-of-bound and -log(upper - lower) for the coordinates ...
4
votes
3
answers
170
views
how to generate random probability arrays with pre specified mean
I have a pre specified mean [0.5, 0.5, 0]. This is a probability array which sum up to 1.
I want to generate several, say 10 random probability arrays (each sums up to 1) whose mean is [0.5, 0.5, 0], ...
0
votes
3
answers
171
views
Fastest way to randomly shuffle an array based on probabilities in PHP? [closed]
I have an array with values and probabilities (or in PHP, keys and values):
Value Probability
John 3
Peter 2
Paul 1
I want to shuffle this array but have the order be influenced by the ...
6
votes
0
answers
148
views
Mean and Standard Devation of Kth Highest Number Given Infinite Samples of Size x
Given:
A list of numbers, "values".
A sample size, x
A kth highest number (ex: [3, 2, 1, 0], 2 is the 2nd highest
number)
Write a function kmax(x, k) that returns the Mean and Standard ...
0
votes
0
answers
47
views
Instrumental Amplifier with Monte Carlo in NGSPICE
I want to try to do the Monte Carlo in this circuit with an instrumental amplifier, but the loop does not work for me, I try to export in a txt file, but the 100 iterations are accumulated in the ...
2
votes
2
answers
79
views
How to make a probability figure using a logistic regression?
I am trying to remake this figure with my data.
I have 2 binary factors (P treatment & Embryo_Presence_vs._Absence) and 1 continuous value (Final_Size). Here is my data:
print.data.frame(x[c(&...
2
votes
3
answers
119
views
Perform a random binomial draw for each row in R without rowwise()
I have an R data frame that I need to perform a random binomial draw for each row. The n = argument in the random binomial draw will be based on a value in a column of that row. Further, this ...
4
votes
2
answers
183
views
How to Analyze the Best, Average, and Worst-Case Performance of a Randomized Algorithm for Finding a Value in an Array?
Consider the following algorithm:
while True:
i = random(1, n)
if a[i] == 1:
return i
The objective is to find a position in an array a[1..n] that contains the value 1, where half ...
0
votes
0
answers
67
views
Does it make sense to generate a unique key from the combination of two different hashing algorithms?
I want to expand on the following question and answers found here:
What are the chances that two messages have the same MD5 digest and the same SHA1 digest?
My interest in this question is not about ...
0
votes
0
answers
118
views
How can I correctly distribute cars across slots based on probabilistic assignment in Lua?
I'm working on a simulation in Lua where I need to randomly assign cars to a set of slots based on probabilities. Specifically, I want the probability for each slot to be adjusted dynamically as the ...
1
vote
1
answer
52
views
Sampling from joint probability mass function in python
I have a non-negative normalized vector p. I would like to sample an index from the index set of the vector. The probability getting sample k is p[k]. Using np.random.choice function, I can write the ...