PDA

View Full Version : Looking For A Random Number Generator


Suicane75
09-13-2011, 12:10 AM
That will spit out 110 numbers all with a value between 0-12, but totaling 1320 exactly. Is this kind of thing out there?

Lathum
09-13-2011, 12:15 AM
i have no idea if it can, but, random.org?

Suicane75
09-13-2011, 12:25 AM
That was the first place I checked and no luck.

sabotai
09-13-2011, 12:27 AM
Good one.

Shkspr
09-13-2011, 12:55 AM
try writing down 110 random numbers from 0-12. if they do not add up to 1320 try writing down 110 more random numbers from 0-12. if they do not add up again maybe random number generation not your game.

Suicane75
09-13-2011, 12:59 AM
Don't be dicks.

Suicane75
09-13-2011, 01:00 AM
No, I appreciate good humor. But I'm serious.

Solecismic
09-13-2011, 01:03 AM
Not trying to be funny or a dick, but 110 12s adds up to 1320.

Shkspr's approach is the only one that makes sense to me from an algorithmic standpoint. A selection cannot be considered "random" unless it has no dependence on any other selection in the set.

So to design an algorithm that meets your needs, I'd do exactly as he suggests. Put out a set of random numbers, then test it. If it doesn't measure up, start again.

Suicane75
09-13-2011, 01:58 AM
Ughh, I effed this up in my head. My bad.

QuikSand
09-13-2011, 06:45 AM
That will spit out 110 numbers all with a value between 0-12, but totaling 1320 exactly. Is this kind of thing out there?

As stated, you don't need random numbers, you need a series of 110 numbers, each exactly 12. There you go!

MJ4H
09-13-2011, 06:50 AM
I can write you a VB program in a few seconds that does what you want, but, um this one indeed is just 110 12s or nothing.

Ronnie Dobbs2
09-13-2011, 07:44 AM
In general, how can it be random sequence and yet reach a desired total (even if other combinations were indeed possible)?

tyketime
09-13-2011, 07:50 AM
In general, how can it be random sequence and yet reach a desired total (even if other combinations were indeed possible)?
Aha! Are you suggesting the possibility of a fixed result? :D

gi
09-13-2011, 09:02 AM
random.org

QuikSand
09-13-2011, 09:12 AM
In general, how can it be random sequence and yet reach a desired total (even if other combinations were indeed possible)?

In trying to keep with the spirit of the question, here's what I would do to set this up. If the final average of the "random" numbers needs to be exactly 6 (my best guess is that's what was intended), then I would essentially pair them up. Every time a 4 comes up, you generate an 8 to go with it (and so forth), and then randomize the order.

Not certain that this is what the goal is, but that seems to me to be the cleanest way to get there.

SteveMax58
09-13-2011, 09:14 AM
In general, how can it be random sequence and yet reach a desired total (even if other combinations were indeed possible)?

I think it could be random sequence but he'd need to set a series of predetermined requirements.

Obviously 1320 doesn't make sense, but lets say 660 is the target total. You could have a set of predetermined value counts...such as 8 or 9 of each value. Then you'd just have to make a variable of each number, & decrement it each time your RNG selects it (EDIT: in order to no longer make it available so that eventually your total can be kept in check. I imagine this type of algorithm would be helpful in keeping balance for a game for instance, as you want a certain talent level but you dont want it to spiral out of control because of poor RNG rolls).

Or if the target total is more important (as well as the 110 count sequence), the distribution could be "close" to equal by doing something like this:

<table border="0" cellpadding="0" cellspacing="0" width="128"><colgroup><col style="width:48pt" span="2" width="64"> </colgroup><tbody><tr style="height:15.0pt" height="20"> <td style="height:15.0pt;width:48pt" align="right" height="20" width="64">0</td> <td style="width:48pt" align="right" width="64">8</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">1</td> <td align="right">8</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">2</td> <td align="right">8</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">3</td> <td align="right">9</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">4</td> <td align="right">9</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">5</td> <td align="right">9</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">6</td> <td align="right">8</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">7</td> <td align="right">9</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">8</td> <td align="right">9</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">9</td> <td align="right">9</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">10</td> <td align="right">8</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">11</td> <td align="right">8</td> </tr> <tr style="height:15.0pt" height="20"> <td style="height:15.0pt" align="right" height="20">12</td> <td align="right">8</td> </tr> </tbody></table>

Pumpy Tudors
09-13-2011, 09:59 AM
Ughh, I effed this up in my head. My bad.
WHO'S THE DICK NOW?

Rizon
09-13-2011, 10:12 AM
Is this the thread where we debate if 0.999... = 1 ?

Ronnie Dobbs2
09-13-2011, 10:58 AM
QS and Steve, thanks for the input. I'd agree your responses go with the "spirit" of the question, but obviously this could never be truly random.

SteveMax58
09-13-2011, 11:37 AM
QS and Steve, thanks for the input. I'd agree your responses go with the "spirit" of the question, but obviously this could never be truly random.

No, you're right. Definitely can't be completely random, but probably a poor word choice as I think he likely means "inconsistent sequence with a fixed total of all values".

Makes me wonder...what the heck is this for?

gstelmack
09-13-2011, 11:38 AM
QS and Steve, thanks for the input. I'd agree your responses go with the "spirit" of the question, but obviously this could never be truly random.

Of course, do you want "truly random", or do you want "appears random to a human"? Those have different answers as well.

Ronnie Dobbs2
09-13-2011, 11:41 AM
Well, it couldn't be pseudorandom either.

edit: at least using that term in the CS seeded fashion.

Shkspr
09-13-2011, 12:33 PM
Speaking seriously, my approach and Quiksand's differ only in degree, but have different drawbacks. My approach takes far too long to develop a suitable data set, Quik's approach produces a symmetrical dataset out of necessity. Steve's approach winds up shaping the set far too much to be random. However, if you were to split the 110 data points into say, 10 data sets of 11 random integers apiece, you could then test each data subset by matching the mean of the subset to the mean of the larger set, and only rerolling the subsets where the means differed. This should provide enough randomness in your full dataset to avoid predictable patterns while being directed enough around your expected sum to avoid an eternity of rerolls.

Suicane75
09-13-2011, 12:59 PM
No, you're right. Definitely can't be completely random, but probably a poor word choice as I think he likely means "inconsistent sequence with a fixed total of all values".

Makes me wonder...what the heck is this for?


Yes. That's what I meant but I had the number wrong, not that the number matters much.

MJ4H
09-13-2011, 01:05 PM
So what exactly do you need. It will be trivial to produce a program that can output what you want.

Suicane75
09-13-2011, 01:17 PM
Well I broke all of college football down into 8 super conferences and I wanted to assign a win total to each team (the 0-12 part). But it needed to equal the number of possible wins in the season (the big number). The number i asked for though would have equaled the total number of games, not wins, so yeah I needed half that number (660).

I was just bored.

gstelmack
09-13-2011, 01:38 PM
Heh, for that I'd just schedule each team, then flip a coin for each game to assign a win or loss. You'll get the results that way.

SteveMax58
09-13-2011, 01:59 PM
Hmm...well the distribution in my example could lead to some odd occurrences then. For instance, you'd be guaranteed to have 8 teams winless, and so (theoretically) could end up with 8 teams in the same conference without a win. Maybe more realistically would be the chance to have all 8 teams have a losing record...which is improbable but more possible.

I think as gstelmack said...schedule all 660 games and flip a coin.

MJ4H
09-13-2011, 02:18 PM
3 6 8 8 6 7 8 5 9 6 0 1 0 0 4 12 6 9 2 4 3 0 1 6 10 1 0 5 8 1 12 11 3 12 0 4 10 8 7 6 9 7 10 9 3 11 1 3 4 9 7 3 7 1 7 10 6 0 11 1 5 8 6 1 11 9 8 9 2 7 0 12 4 11 1 0 10 2 12 9 2 0 1 12 7 4 11 12 9 9 8 1 6 4 9 5 10 12 3 2 11 12 6 10 4 6 10 3 9 4

Let me know if you need more or need them in a different way.

sovereignstar v2
09-13-2011, 05:14 PM
The co-commish, ladies and gentlemen.

Hoya1
09-13-2011, 06:57 PM
The co-commish, ladies and gentlemen.

:D

QuikSand
09-13-2011, 09:33 PM
Who had the over on the entertainment value of this thread?

Maple Leafs
09-13-2011, 09:46 PM
Who had the over on the entertainment value of this thread?
You mean on the original line of 12, or after all the action on under shifted it down to 6?

britrock88
09-14-2011, 08:46 AM
Should I go to the trouble of pointing out that there are 120 teams in D1A? Now we're talking a 720 total...

MJ4H
09-14-2011, 09:04 AM
I just did 110 random numbers from 0-12 and had it retry if it didn't add up to 660. I didn't read all of the arguing about what he actually wanted or why. I was just trying to be helpful. I can provide an exe that will output these numbers over and over again or modify it however you would like. I glanced through a few posts and saw that you might want to make pairs of numbers or whatever. I can do that, too. Happy to help if I can, just let me know.

Note that I am not proposing that any series of numbers I give or an exe solves whatever problem you are trying to solve, I'm just trying to do the gruntwork of giving you the numbers.

Suicane75
09-14-2011, 11:51 AM
I am a proud people. I am not from laughing stock.