This tag is for questions pertaining to random numbers, whether pseudo random or truly random.

learn more… | top users | synonyms

2
votes
2answers
32 views

Randomly pick a host from a list, subject to an uptime requirement

I have a POJO as shown below which will have hostname and other attributes. ...
11
votes
3answers
474 views

Predicting the next pseudorandom value

The archived material for the Stanford University course on cryptography at coursera.org includes a problem where you have to predict the next output of a weak PRG. It can be briefly restated as ...
3
votes
1answer
43 views

Generate Random String and Writing to File

my task is to generate random strings and store in a file till the size of file is less than 10MB. My approach towards this problem is as follows. ...
2
votes
0answers
56 views

Generate a random numbers class - follow-up

Previous question: Generate a random numbers class I have come up with three different ways to define type of mUniformDistribution. All of them work fine in VC++ ...
12
votes
1answer
87 views
+300

Alea implementation

The following is an implementation of the Alea random number generation approach by Johannes Baagøe, reworked from the rot.js implementation by dropping all the pesky underscore prefixes in the ...
3
votes
2answers
44 views

Scoring system of a pool of dice

I want to do some Monte Carlo simulations on a system based on a pool of dice. For each trial, a number of dies are rolled, and the winner is the highest value, getting as many points as dice are over ...
7
votes
1answer
102 views

Generate a random numbers class

I have made class to setup a random number bases on <random>. It works fine, but I have doubt in ...
2
votes
1answer
122 views

Tic-Tac-Toe in C++11 - follow-up 4

Previous question: Tic-Tac-Toe in C++11 - follow-up 3 I've been told to use <random>. However, it seems a bit more complicated than it looks to generate ...
3
votes
2answers
104 views

PHP secure random number generator

I just wrote this function and I was curious if anyone could find any flaws in it? It look pretty secure to me but I just want to make sure since I'm no cryptography expert. ...
3
votes
0answers
25 views

Random numbers, IO monad, and pure code

To get used to Haskell, I wrote a little program using the Diagrams package which generates 100 random dots (larger dots are more likely to be in the center). ...
1
vote
1answer
39 views

Random Distribution to fit an Average Python

This is from my own question on Stack Overflow. I want to get average numbers from a range such that they fit an intended average. I expect something bell-curve-like, but asymmetrical unless the ...
3
votes
1answer
53 views

Virtual Slots Implementation

What I can do to make this code more efficient? It is supposed to be like one of those slot machines where you gamble on it and stuff (like at a casino). ...
6
votes
2answers
108 views

Generating non-repeating random integers in a fixed range

I was working on the "Robot Name" exercise over on exercism.io (neat site, by the way), the gist of which is: Generate random, unique strings that match ...
3
votes
1answer
85 views

Generate a random integer of length N with unique digits

The task is simple: given N, generate a random integer with no repeating digits. ...
3
votes
1answer
57 views

Percentage based drop prize on Mob entity kill

I have created a simple percentage-based random prize drop for killing certain mobs. A drop is basically what the player will get in return for killing a mob, as a reward. So I have a large list of ...
4
votes
1answer
82 views

Simple math facts game

I've made a simple game for testing math facts (think practice for elementary school-age kids). It displays a random addition, subtraction, multiplication, or division problem, and feedback on if the ...
4
votes
2answers
469 views

Random Quote in java

Problem Statement: Create a class diagram and Java code for the following system and scenario, taking into account the possibility of future extensions. "The system is a command line utility ...
1
vote
1answer
51 views

Playing “craps” for the win v0.3

Continud from Playing “craps” for the win v0.2 You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots, respectively. After the dice have come to ...
1
vote
2answers
119 views

Playing “craps” for the win v0.2

Continued from Playing "craps" for the win You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots, respectively. After the dice have come ...
0
votes
2answers
64 views

“Random Quote Of The Day” program [closed]

Problem Statement: Create a class diagram and Java code for the following system and scenario, taking into account the possibility of future extensions. "The system is a command line utility ...
10
votes
2answers
370 views

Playing “craps” for the win

No specific question here. I am beginning with Java and here is an exercise. The rules of game: You roll two dice. Each die has six faces, which contain one, two, three, four, five and six ...
1
vote
1answer
122 views

Lottery number picker

This is my first Python project. Let me know how I did, and where I can improve it. ...
1
vote
0answers
97 views

Using basic methods to make a high/low game [closed]

This is my first big project with using methods. My prompt is to: Write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice ...
8
votes
3answers
602 views

Randomized response generator for number-guessing game

I am currently learning C and playing around with the rand() and if/else statement. This ...
6
votes
3answers
1k views

Generating a not-the-same-as-last-time random number

I have to generate random number which differs from the number generated last time. Which of these two variants is better? Or maybe you can suggest better implementation. ...
8
votes
5answers
569 views

Probabilistic matchmaking simulation

The following is a problem I found on this wiki. What can I do to optimize my algorithm, and make this code more C++11? Write a program to discover the answer to this puzzle:"Let's say men and ...
19
votes
3answers
2k views

Proof that I was wrong about Random Number Generators

I wrote this code to show how wrong I was about Random Number Generators. Context: From Comments to this answer to Regularity in the "Rusty Towel of Mutual understanding" that isn't ...
1
vote
3answers
355 views

Pseudo-random generation able to regenerate backwards

Using the accepted answer from this question, I made a random number generator which can regenerate previous numbers in order. Ideone version ...
4
votes
1answer
94 views

Small pre-C++11 pseudo-random library

Some time ago (pre-C++11) I wrote a small random number generator library as part of a university assignment. The code has been stored on my hard drive for quite some time and today I dug it out and ...
5
votes
1answer
93 views

Software Key Generator

I have created a Java program which generates a key (for activating a piece of software for example) my code works correctly however there are parts of it that I know can be improved. In particular ...
3
votes
2answers
73 views

Write a function to extract a given number of randomly selected elements from a list

I'm going through the 99 Haskell problems and I have a few question about the solution I implemented for Problem 23. It asks: Extract a given number of randomly selected elements from a list. ...
3
votes
1answer
34 views

Input on where and how I can make improvements on my randomizer

As my title states I'm just looking for a little input on how I can improve one of my side projects when I'm not doing my CS assignments. All my program is, is a primitive randomizer for Battlefield 4 ...
6
votes
6answers
799 views

Prevent repetitive random numbers

Is this a good way to prevent repeating numbers, or is there a better a better, more efficient way of doing this? By efficient, I mean a less CPU and memory consuming process. I only mean two numbers ...
4
votes
1answer
57 views

Simulating the martingale betting system with roulette

I wrote a program that simulates many instances of trying the martingale betting system with roulette in Haskell. At the answerer's suggestion I opted to leave the ...
0
votes
2answers
172 views

Really basic terrain generator

This is my first attempt at writing a c++ program, so bear with me. I tried to use as many methods as I learned in about a week-long period. ...
35
votes
14answers
7k views

Generate random numbers without repetitions

I want to generate a list of N different random numbers: ...
10
votes
7answers
851 views

Too-high / too-low guessing game in Swing

I have created this program and it works fine. It's just that its too wonky and huge so I was wondering if anyone knew how I could shorten the program so I didn't have to put all of these into each ...
2
votes
2answers
68 views

Optimizing a particle filter weighted selection step

I have a vector with 10000 particles that I use in a Particle Filter. The problem is that it's taking too long to compute the weighted selection of the particles. I want to use a vector of weights ...
13
votes
4answers
942 views

Random name-picker with array

I created a program that picks a champion for a role on the game League of Legends using arrays and random numbers. Is there a quicker and more efficient way of doing this? There is one form that ...
2
votes
2answers
116 views

Change random methods without losing too much performance

I have a class in C# that uses a Random object to get a list of numbers randomized from an array of 1-25. Now what I need is improve this method to use ...
1
vote
1answer
28 views

Generating Passwords with a Secure PRNG

What's the best way to approach generating a password using a secure prng? In Python, I could simply use os.urandom. Any suggestions on this? ...
7
votes
4answers
1k views

Dice-rolling program

I am sort of new to programming. I would like to understand the code areas that are garbage and could be better written keeping the exact (if possible) behavior the code has now. ...
3
votes
1answer
131 views

Random Schedule Generator

In an attempt to try something new, and possibly help out at work, I tried creating a random schedule generator that generates schedules based on 3 inputs (Rotation length, Staff list, and Shift ...
6
votes
3answers
632 views

Shuffling function using rand()

I would like to hear your suggestions about my shuffling function in C++. I've decided to take advantage of using rand() to build a shuffling function. ...
6
votes
3answers
166 views

Cryptographic Random Number Generator function implementation

While surfing and through some experimentation, I have a new method to generate random numbers without using Randomize or Random ...
1
vote
1answer
56 views

Securely shuffling an array with 75 numbers in Go

I have a SHA512 hex string consisting of my random input and that of the user. Since rand.Seed only accepts a int64 I can never ...
16
votes
4answers
2k views

Generating 1000 random numbers

I have got the following C code and I feel it is crazy stupid and there must be a better way to do this, but just can't think of one and have yet to learn algorithms. ...
1
vote
2answers
90 views
5
votes
4answers
174 views

Checking if a random number exist within an interval efficiently

I have a problem where you have a bunch of probabilities associated with a number. In this case: any number between 0 - 0.3 should return 0, any number between 0.3 - 0.7 should return 1, any number ...
10
votes
2answers
82 views

Increase the performance of a random weighted 'tick' function

This is a very simple function, but it gets run on a roughly 10ms interval, so I'm looking for ways to improve it. The first obvious thing is that it has to run the comparisons nearly every time as it ...