The random tag has no wiki summary.
3
votes
1answer
75 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
356 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.
1
vote
2answers
129 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
137 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
197 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
128 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
167 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 ...
1
vote
1answer
123 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 ...
3
votes
1answer
557 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
537 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
485 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
1answer
119 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 ...
14
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
1k 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 ...
0
votes
0answers
158 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 ...
4
votes
1answer
616 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 ...
44
votes
4answers
2k 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
526 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
408 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 ...
3
votes
4answers
804 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 ...
32
votes
6answers
2k 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
349 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
351 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 ...
2
votes
6answers
747 views
Randomly select from list with increased odds
I have a list of entities. Every entity contains a number that holds how many times the entity has been selected. I need to make a function that selects n (say 25%) of the entities, randomly. What I ...
5
votes
5answers
283 views
What is the difference between _Procedural Generation_ and _Random Generation_?
Today, I got into an argument about the term "procedural generation".
My point was that its different from "classic" random generation in that procedural generation is based on a more mathematical, ...
3
votes
5answers
703 views
How to create a random generator
How could a random generator be implemented?
I'm not speaking about the invocation of a language mathRandom() method, but the implementation of the routines that lead to generate numbers totally ...
4
votes
4answers
326 views
Is code that terminates on a random condition guaranteed to terminate?
If I had a code which terminated based on if a random number generator returned a result (as follows), would it be 100% certain that the code would terminate if it was allowed to run forever.
while ...
3
votes
1answer
382 views
Hash Algorithm Randomness Visualization
I'm curious if anyone here has any idea how the images were generated as shown in this response: Which hashing algorithm is best for uniqueness and speed?
Ian posted a very well-received response but ...
1
vote
3answers
248 views
Random List of numbers in C
I have just started a C programming course and so far have only done the basics like printf, read a little on variables etc on the course book. The teacher has tasked us with writing a program that ...
0
votes
1answer
75 views
How to test a random-generating feature in application? [duplicate]
Possible Duplicate:
How should I test randomness?
One of the features to be developed in our application was allowing user to click a button which will choose an element at random out of ...
5
votes
3answers
1k views
How to generate random numbers without making new Random objects?
I'm using this as part of a game, but it's not really a game development question, so I'm putting it on this more general Stack Exchange.
The goal is to generate "random" outputs for a fixed integer ...
6
votes
1answer
220 views
Random Cache Expiry
I've been experimenting with random cache expiry times to avoid situations where an individual request forces multiple things to update at once. For example, a web page might include five different ...
3
votes
6answers
2k views
random generator not good enough?
During an interview I was asked to implement a random generator in java without using any existing random number libraries that takes as an argument int n, and returns a random number between 0 and n. ...
14
votes
7answers
2k views
How to generate “language-safe” UUIDs?
I always wanted to use randomly generated strings for my resources' IDs, so I could have shorter URLs like this: /user/4jz0k1
But I never did, because I was worried about the random string generation ...
1
vote
2answers
608 views
What's a good algorithm for a random, uneven distribution of a fixed amount of a resource?
Problem
I have X, a positive integer, of some resource, R.
There are N potential targets.
I want to distribute all of R to the N targets in some "interesting" way.
"Interesting" means:
Some ...
11
votes
3answers
735 views
Randomly generate directed graph on a grid
I am trying to randomly generate a directed graph for the purpose of making a puzzle game similar to the ice sliding puzzles from Pokemon.
This is essentially what I want to be able to randomly ...
25
votes
11answers
1k views
Unit testing methods with indeterminate output
I have a class that is meant to generate a random password of a length that's also random, but limited to be between a defined min and max length.
I'm constructing unit tests, and ran into an ...
4
votes
1answer
311 views
random.choice in other languages
Python has a nice function in the standard library random.choice which returns a random element from a sequence. But none of the other languages I've developed in have thought to include such a ...