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

learn more… | top users | synonyms

2
votes
0answers
23 views

Simulate Random Risk Battle

For Prof. Yorgey's 2013 Haskell course, I'm working on a homework to simulate a Risk battle. ...
1
vote
2answers
46 views

Generate random unit vectors around circle

I'm trying to generate a bunch of uniformly distributed unit vectors around the unit circle. Here's my code, which is working, but unfortunately I have a for-loop. How do I get rid of this for-loop? ...
4
votes
3answers
151 views

Vertical Histogram

I've been been working on a vertical histogram that prints an asterisk in place of a number in a certain range (say 1-10... and so on). My code is working as required. Is there a better, simpler or ...
-3
votes
1answer
34 views

Simple betting game in python not working [closed]

So the problem I am having with this code is that when I run the code, there are no issues, however when it gets to the result of the dice roll, it does not subtract money if the person lost the bet, ...
4
votes
1answer
125 views

Sudoku generator

I managed to create a Sudoku generator but I'll just go ahead and say that it generates 1 out of 500 tries on average. I'd say that's pretty inefficient and I'd like to ask you for advice on ...
8
votes
3answers
2k views

Completed Town Generator

I am a beginner, and I believe I made a simple and efficient program to do it in. I can add more methods for more detail for future updates, but it's a workable bit. ...
0
votes
4answers
16 views

Removing random repeated guesses from brute force program

I came here to ask if there is a way to prevent already guessed guesses from being guessed again in my brute-force Java program. Basically I used a rand.nextInt in ...
2
votes
2answers
236 views

Math equation generator program

I am building this program in Python to generate 10 random arithmetic questions of either multiplication, addition or subtraction and then saves users scores to a .txt file. I just wanted some help ...
5
votes
5answers
592 views

Interactive dice simulator

After finishing my course on CodeAcademy, I wanted to write a program. Please provide opinions. ...
11
votes
3answers
763 views

License and Registration, Sir

The following code will generate a number plate and then generate a random speed and see if it's speeding ...
13
votes
2answers
314 views

Pi by Monte-Carlo

I was inspired by this SO post to investigate a good Java8 way to calculate Pi based on simulation. I used a similar task to learn about parallel programming on both CUDA, and Intel Xeon Phi ...
10
votes
3answers
371 views

Souped-up random walk terrain generator

I started learning Python a couple of weeks ago, and to test my new knowledge of Python, I decided to use Pygame to code a random walk terrain generator. ...
4
votes
3answers
251 views

Random walk in Python + turtle

I decided to implement a random walk. The rules The rules are easy, an object is moved in the direction dictated by random or pseudo-random numbers. If you want to read more about it, see the ...
2
votes
2answers
42 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
489 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
59 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
64 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++ ...
15
votes
1answer
127 views

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
47 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
112 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
126 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
113 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
28 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
41 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
56 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
123 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
139 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
65 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
90 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 ...
5
votes
2answers
493 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
53 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
133 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
70 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
383 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
174 views

Lottery number picker

This is my first Python project. Let me know how I did, and where I can improve it. ...
8
votes
3answers
614 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
579 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 ...
20
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
374 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
107 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
102 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
75 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
37 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
952 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
67 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
182 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
10k views

Generate random numbers without repetitions

I want to generate a list of N different random numbers: ...
10
votes
7answers
896 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
69 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 ...