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

learn more… | top users | synonyms

-3
votes
0answers
32 views

I can't make my code functional. [on hold]

These are the errors I am getting. I googled them and I went through my code and don't see what I need to fix. ...
1
vote
0answers
61 views

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

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
548 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
958 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
556 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
336 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 ...
3
votes
1answer
77 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
81 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
67 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
33 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
630 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
45 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
156 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. ...
34
votes
14answers
4k views

Generate random numbers without repetitions

I want to generate a list of N different random numbers: ...
10
votes
7answers
774 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
61 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
736 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
109 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
25 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
91 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
392 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
133 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
49 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
65 views
5
votes
4answers
166 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
75 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 ...
6
votes
1answer
757 views

Generating random email addresses [closed]

The code below generates only 10 email domains. To me, this is bruteforce programming. Is there another random integer library? Could I use something like ...
13
votes
4answers
1k views

Simple random number generator

I have been wanting to learn programming for some time now and decided to really give it a shot today. I have edited and read lots of things in Java to fix small issues but never written from scratch. ...
5
votes
1answer
66 views

First text game with Python - Higher or Lower

Recently I have been learning Python programming, for about a week. I have covered all basic stuff - loops, strings, input masks - and have challenged myself by making a little game. It isn't much, ...
6
votes
3answers
112 views

Generate random 10% of file to be used in testing with Ruby

I'm new to Ruby, but not to programming. I just need a simple script that, given a text file, will pull out around 10% of the lines at random. Below is what I came up with based upon a Python script ...
4
votes
2answers
176 views

Pseudo-random number generator implementation check

I was searching for a pseudo-random number generator for C# and stumbled upon Tales from the CryptoRandom by Stephen Toub and Shawn Farkas, so I tried to implement a variation of their code. The main ...
4
votes
3answers
197 views

Random 6 to 10 digits number

I am generating a random numerical 6-10 digit password. I need some important reviews of yours. Is it OK or are there some needed modifications? ...
3
votes
1answer
26 views

Implementing `randoms`

Learn You a Haskell presents the randoms function. I implemented it as follows: ...
10
votes
1answer
108 views

Random Coin Toss in Haskell

Learn You a Haskell gives an exercise to implement the following function: ...
2
votes
1answer
52 views

Ensuring client IDs are unique

I'm writing a node.js application that involves handling clients based on their ID without any real way of confirming that the ID a client says it has is its actual ID. That is, it's possible for a ...
8
votes
4answers
532 views

std::vector composition with self populating super-powers

I have written a deliberately pretty simple class that wraps a std::vector to basically make it capable of self-populate itself with random generated numbers, ...
2
votes
1answer
43 views

v2 - Adding a duplicate entry randomly into a list in haskell using random monad

Next version of Adding a duplicate entry randomly into a list in haskell using random monad I wrote this trying to set up a Haskell testcase. The aim is to take a list and add a single duplicate from ...
4
votes
1answer
20 views

Adding a duplicate entry randomly into a list in haskell using random monad

There's a new version of this as v2 - Adding a duplicate entry randomly into a list in haskell using random monad I wrote this trying to set up a Haskell testcase. The aim is to take a list and add ...
2
votes
2answers
47 views

Simple evolutionary string matching

This is based on a very similar question I asked, found here. The intent of this program is to start with a set number of random strings of zeros and ones, and eventually evolve them to find one ...
5
votes
2answers
84 views

Change random list of numbers into all 5's using simple evolution simulation

This is supposed to be an evolutionary algorithmic program, and I'm not sure if it does what it's supposed to do. It is supposed to take a random list of numbers (containing at least one 5), and over ...
7
votes
2answers
555 views

How random is this password-generating algorithm?

This code's sole purpose is to create a very random password, using letters and numbers. I think that it fulfills its purpose, but I wonder, could it be done better? I'm not talking about ...
5
votes
2answers
126 views

Python script for generating random C code

I'm writing a Python script to randomly generate C functions. This is my first time using classes in Python and I'm basically doing my best to pretend I'm using Java. I'm looking for a review of my ...
1
vote
1answer
35 views

Seeding a PRNG - Custom Setter

I have a PRNG-Class called Generator. Now, after creating a new instance of it: var g:Generator = new Generator(); Custom ...
3
votes
2answers
355 views

Generating a random string of characters and symbols

After coding this, I was wondering if there are any ways in which I can improve upon it. It generates a random string of characters and symbols the same length as what is entered by the user. It uses ...
7
votes
4answers
1k views

Read from a file and pick a random line

I've been learning Java lately and had some great feedback from the previous threads (hangman and guess a number games). I was challenged by a user to try to get this code done, so I'm posting it here ...
2
votes
1answer
88 views

Optimized solution for a rolling dice code puzzle

I was asked to provide the solution of this rolling dice problem in an interview. When I showed him my solution, he said that there is another way to find the solution. I am looking for answer in PHP ...