The tag has no wiki summary.

learn more… | top users | synonyms (1)

-4
votes
1answer
61 views

How do I use a list of int to set the index of another list [closed]

I want to use a list called index with only ints to use it to set the index of another list. index = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26] dictionary = ["a", "b", ...
4
votes
3answers
533 views

How to pick a random move/action/element non-probabilistically?

I am trying to create a simple AI that can play Go using Monte Carlo Tree Search. This question, however, is valid for all games where players take turns doing some action that, on average, reduce ...
1
vote
1answer
119 views

Big O notation of randomness

I was thinking about inefficient algorithms based on randomness and wondered how to categorise them. For instance. Say you wanted to generate all the numbers from 1 to N in a random order but only ...
-1
votes
3answers
145 views

How “good” are PC randomly generated variables? [closed]

I read that computers count random variables by some algorithm, so the value of the variable is predictable and is called a pseudo random variable. For real randomness one should connect a Geiger ...
1
vote
3answers
95 views

Generate random numbers with certain spikes? [duplicate]

I am trying to generate random numbers to simulate steering wheel angles and velocities of a car. So for steering wheels the random numbers could go like 1,2,4,6,4,3,40,0. I can generate random ...
3
votes
1answer
77 views

Should changes to FNV-1A's input exhibit the avalanche effect?

This is kind of related to Which hashing algorithm is best for uniqueness and speed?. In that question, the excellently written top answer notes, Randomnessification The other subjective ...
0
votes
1answer
179 views

Would adding more digits be a way to scale a order generation service? [closed]

I am working on interview questions from Amazon.com Software Development Engineer Intern Interview Questions. One of the interviewees was asked "give a scalable system design of Amazon.com's order ...
1
vote
2answers
148 views

c++11 random: why different range of int and real?

In the c++11, we now have <random> to produce random number. About uniform distributions, we have following int_distribution and double_distribution: uniform_int_distribution-produces integer ...
0
votes
2answers
138 views

Why is the “period of a (pseudo)random number generator” important?

I've been trying to understand (pseudo)random number generator code from various sources and the concept of the period continues to elude me. To satisfy the minimum level of understanding, I've tried ...
3
votes
1answer
74 views

How specify acceptance criteria for randomness?

How would I express a Behavior Driven Development (BDD) acceptance criteria/story/scenario that indicates items should be random to some degree on a Home screen of an app like Instagram? Here's what ...
2
votes
1answer
134 views

How to randomly get or find a sub-tree (include root node) from a given tree that contains n leaf-nodes

I have a non-binary tree. I want to randomly find a "sub-trees" that are connected from root to leaf which must have at least n leaf-nodes (leaf-nodes of sub-tree must be leaf-nodes of given tree). ...
0
votes
0answers
27 views

Specific weight randomness based on a curve [duplicate]

I had a problem where I had a list of objects and I wanted the ones near the front of the list to "appear more" then the others when chosen randomly. There wasn't any specific weighting involved for ...
3
votes
3answers
452 views

Choosing a random integer in a range such that it doesn't equal a particular number

Given an integer range and a number within that range, what's a reasonably robust and efficient way to randomly select a new number within the range such that it's not equal to the given number? ...
1
vote
2answers
420 views

Is generating a large random number more unique than generating each digit in that number?

I'm using a PRNG (PHP's default rand() implementation) to generate unique 16 digit numbers. Does it make sense to generate digits one by one, or the number at once? I'm using PHP.
2
votes
2answers
168 views

On-the-fly, random partition of a range of numbers [0,N] in groups of max M size

Suppose that you have a range of numbers from 0 to N that you want to randomly separate in groups of max M sequential numbers. This is easily done with a bitmap and a random number generator, but it ...
0
votes
1answer
69 views

No repeated coordinates in random walker ensemble

i'm simulating an ensemble of random walkers in 2D in python, I set [x,y] coordinates of my walkers to be gaussian in a 2D grid, then use a rand array of -1 and +1 to move up down left right: N=20 ...
7
votes
1answer
387 views

Original source of `(seed * 9301 + 49297) % 233280` random algorithm?

If you search for examples of creating a seeded (pseudo)Random number generator, you will run into stuff like this (specific example http://indiegamr.com/generate-repeatable-random-numbers-in-js/): ...
-1
votes
3answers
197 views

Generate unique integer from two integers with algorithm

I am currently trying to come up with an algoritm which would take at least two numbers (say user IDs) and then come up with an unique number which is generated based on these two numbers. Each ...
-1
votes
1answer
195 views

Unevenly distributed random number generation [duplicate]

Let's say I have to generate random number from 1 to 100, however, the probability of each number is not 1/100, but a predefined probability. How to generate that number? I use Ruby/Python.
3
votes
2answers
216 views

Whether to store all numbers or just their ranges in database for this application

I'm developing a (PHP MySQL) Web App which will sell dynamically generated real time cell phone numbers for cellular companies. A company will ask for, say, a thousand numbers and this app will check ...
0
votes
2answers
155 views

Permutation tests for large sequences

I would like to perform a permutation test on a particularly large data set, i.e. around 4 million entries. Basically, I need to get some number of random permutations of this data set. Usual way to ...
3
votes
1answer
127 views

Defining a random “safe” path for a game character

I am writing a game in Java and it can be likened to the recently popular game "Flappy Bird" in the sense that the character moves up and down and the users touch and must avoid the obstacles. The ...
1
vote
3answers
445 views

When calling for a random integer from 1-6, how can I make it gradually get less likely to pick a number the bigger it is? [duplicate]

Like having 1 be the most common number and 6 be the least common number. And everything else just leveling out.
0
votes
2answers
246 views

Are random number generators security holes?

If I retrieve a random number from a database (e.g. RAND() in SQL Server) or using a programming language and send this in some form back to a client machine, is there an economic chance I will be ...
0
votes
2answers
266 views

What should I use as a random seed in a Brainfuck?

As I understand it, most pseudo-random algorithms work by taking one or more truly random longs, such as the date, time, MAC-Address, serial-number, etc., passing them through a complex series of ...
-4
votes
1answer
1k views

What's the algorithm of “Shuffle Mode” in audio/music players [closed]

I was researching on how is the "Shuffle mode" in music players implemented and what is the algorithm behind this. How it makes sure that any songs won't repeat? What's the most efficient algorithm ...
1
vote
1answer
556 views

How can I create a set of random numbers based on a total and number of objects?

For example with: Total population = 400000 Number of villages = 800 The average population is 500 How can I randomize the amount of people in each village using a specified deviation (eg +-50) so ...
1
vote
2answers
190 views

Random access (read/write) in datastructures

Certain datastructures, like Python's Dictionary, are unordered/random read/written. As programming in python is iterative (and programming in general is?), how do these unordered datastructures ...
0
votes
2answers
298 views

How deterministic are SessionIDs from SHA'd GUIDs?

Assume I'm using the following code to generate pseudo-random sessionID's: sessionID = SHA-512(GENERATE-GUID()) The GUIDs are pretty deterministic, i.e. I see lots of GUIDs with a lot of the same ...
2
votes
1answer
169 views

Generating a Nakagami Random Variable

Assuming the only tool for generating random numbers I have available is generating a uniformly distributed variable u on U(0,1). I want to generate a Nakagami Random Variable from it. I know I could ...
1
vote
1answer
192 views

Randomly and uniquely iterating over a range

Say you have a range of values (or anything else) and you want to iterate over the range and stop at some indeterminate point. Because the stopping value could be anywhere in the range, iterating ...
12
votes
2answers
1k views

Since Garbage Collection is non-deterministic, why isn't it used for secure random number generation?

I get that /dev/random is a good source of entropy, and is what is usually used-- It's just as I'm reading up on GC, at least in Java, it seems accepted that the garbage collection daemon executes ...
5
votes
1answer
2k views

How Python random shuffle works?

How shuffle from random works in Python? I ask because it works very fast. When I try to write shuffle it works 1 minute for 10^6 element, but Python shuffle does that in 8 sec?
3
votes
2answers
708 views

Which of these two shuffle algorithms is more random?

Which of below two shuffle algorithms (shuffle1 and shuffle2) is more random? public final class Shuffle { private static Random random; public static void shuffle1(final Object[] array) { ...
2
votes
3answers
1k views

Best way to choose random element from weighted list

I want to create a simple game. Every so often, a power up should appear. Right now the different kinds of power ups are stored in an array. However, not every power up should appear equally often: ...
-3
votes
3answers
442 views

More Accurate Random in C [closed]

I have 3 IPs and every IP has a weight, I want to return the IP's according to its weights using the random function. For example if we have 3 IP's X with weight 3 Y with weight 3 and Z with weight ...
3
votes
1answer
167 views

Is there a name for a randomized heap?

I've made a container which functions like a Binary Heap in terms of insertions and popping the root element. The key difference is that the comparison steps are all replaced with a random call for ...
13
votes
10answers
1k views

Find out whose turn it is to buy the croissants, accounting for possible absences

A team has decided that every morning someone should bring croissants for everybody. It shouldn't be the same person every time, so there should be a system to determine whose turn it is next. The ...
5
votes
3answers
2k views

random unique pair numbers from two range

I want to write a function that return random unique pair numbers every time call it from a range until resetting it. Something like this: function randomUniquePairs($ranges, $reset = false){ if ...
1
vote
0answers
210 views

Performance of a Skip-List algorithm

Here is a simple code for a randomized skip-list: Coin_Side flip() { if ( random() % 2 == 0 ) return HEADS; else return TAILS; } Note: random() returns an integer that uses ...
8
votes
4answers
1k views

Can a random number generator ever produce different output given identical seeds?

The title sums it up. I'm interested to know if there exists an algorithm capable of producing variable output given identical input without relying on other sources for randomness such as ...
4
votes
1answer
1k views

Randomization of biomes

You know how in Minecraft, the World is ever-expanding and all the biomes are randomized? My generalized question is: In relation to a space simulation that is also ever-expanding as the player moves ...
45
votes
4answers
3k views

How do functional languages handle random numbers?

What I mean about that is that in nearly every tutorial I've read about functional languages, is that one of the great things about functions, is that if you call a function with the same parameters ...
3
votes
3answers
743 views

Guid collisions

I have a product that lets game developers create games. Inside of their games they are required to give all the elements of their games GUIDs. I've told them that they need to generate their guids ...
1
vote
3answers
700 views

How to generate random numbers with a (negative) sloping distribution?

Given a maximum integer value M, I want to generate N integer values that are distributed with a lower frequency when approaching M (preferably M should still have a non-zero probability). I don't ...
0
votes
2answers
379 views

Can an 81 digit number generator lead to copyright infringement? [closed]

I'm looking to write a program that will generate valid sudoku puzzles. Essentially, a sudoku puzzle is just an 81 digit number. (The blanks are zeroes.) I would then like to use these puzzles in an ...
3
votes
4answers
1k views

Is there such a thing as truly random? [closed]

I saw a video about random numbers and how the programmer in that video was talking about computers generating pseudo random numbers and that they are not really random. I knew about this. Then he ...
33
votes
6answers
3k views

I'd like to write an “ultimate shuffle” algorithm to sort my mp3 collection

I'm looking for pseudocode suggestions for sorting my mp3 files in a way that avoids title and artist repetition. I listen to crooners - Frank Sinatra, Tony Bennett, Ella Fitzgerald etc. singing old ...
1
vote
4answers
463 views

Randomness in Acceptance-Tests

I've got a simple authentication solution, where a user can log in with either email or username. Since I want to show the little feature in the acceptance tests but don't want to pollute them, I ...
3
votes
5answers
613 views

python random with a skew

I am trying to create a very simple evolution algorithm for a creature simulator, what I would like to have is, both creatures have a trait and a dominance level, both noted by ints. their child's ...