All Questions
Tagged with algorithms random
41 questions
-4
votes
1
answer
83
views
How to write a sporadic metronome?
I already asked this question on stackoverflow -- I am posting it here as well, because I think many of you will have encountered an analogous problem. I would appreciate even a link as a reference, ...
2
votes
3
answers
901
views
Algorithm for random weighted boolean shuffles?
I don't exactly know how to phrase the thing I'm searching for in a succinct way, which also made it hard to research.
In my application I need a random list of booleans, say of length five. The ...
1
vote
2
answers
1k
views
How to shuffle a large data set without touching every row?
Let’s say I have two larges arrays of users with equals number of rows and I want to match them randomly and one to one(one from the first array,one from the second), I will first need to shuffle one ...
4
votes
2
answers
3k
views
Shuffle in music players
I always hear how it is hard to implement shuffle algorithms for music players, but never really the explanation for it. What makes it hard?
Take for example how I would implement one:
First the user ...
-1
votes
1
answer
2k
views
Generating billions of Unique random number [closed]
I recently attended an interview. In that I had to solve the issue for generating an billions of random unique number.
For example method signature is as below :
public Iterator<Long> ...
0
votes
1
answer
449
views
Find Randomized Sequence Seed To Compress files statistically
I was wondering if what I have in mind already exists in any known compression programs/algorithms or not. We know that Seed gives us constant sequence of random numbers. so if we be able to find seed ...
1
vote
2
answers
107
views
Disk file structure for large string list with fast reads by index
I have large list of strings. Each string is of different length, just like sentence in text. Average length is below 255 chars.
Please, propose file structure on disk to enable fast picking of random ...
1
vote
3
answers
221
views
Randomly sorting a list where some states are illegal?
I want to make a randomizer for the items in the game La-Mulana. However, some arrangements of items would mean that the game cannot be completed. Sometimes there's only one group of items required to ...
5
votes
4
answers
839
views
How to generate a random bag of positive integers that sum up to an input number?
A number N and a range a to b will be input by the user, with a < b < N.
The program purpose is to generate random sets of positive integers that sum up to N, with each positive integers within ...
5
votes
2
answers
297
views
Is a random sample from a range of uniformly distributed values still uniformly distributed?
Let's say I have a random number generator from which I am requesting values for event A and event B. Both events occur at random intervals but event A happens much more often than event B and I would ...
0
votes
1
answer
131
views
Return random item by its weight, advanced level
There are many typical questions like Return random `list` item by its `weight`
Imagine more advanced problem.
You have N sources of pair (item_id, weight) information. Let's call them Shards. ...
4
votes
2
answers
4k
views
Generate a unique random 4 digit number from another 4 digit number
I have a database that has two columns. The first column is an index, the second is the path to a data file. There are two types of data files, X and Y. These data files are then processed and graphs ...
4
votes
3
answers
177
views
Restricted randomization of a binary vector
Suppose I have a binary vector of sample size N with each of the two possible values (e.g., 0 and 1 occurring equally often).
For example, if N=10, the binary vector is: 0 0 0 0 0 1 1 1 1 1
Suppose ...
0
votes
0
answers
48
views
Pseudorandom in Android
I am building a security mechanism and I need a Pseudorandom functionality in my app. More particularly I need to convert a String to fix length.
My strings are random already, they just to long so I ...
0
votes
2
answers
479
views
What is a readable algorithm for selecting a random buyer based on what they purchased?
I am working on a giveaway algorithm to select a customer based on what they purchased:
If they purchase item 1, they gain 1 point.
If they purchase item 2, they gain 2 points.
If they purchase item 3,...