Help With A Simple Program

VictorEremita

Beta member
Messages
2
Location
US
Hello all!
I'm looking for help with a program that is presumably (I haven't enough programming experience to say with certainty) easy to write.

It will help me with a little game I'm working on. Basically, the premise is as follows:
I will provide a list of numbers.
The program must choose numbers from this list.
Each entry will have one number, from 1 to infinity, and another, explained below.
The lowest possible number (second number of an entry) will be 0.01. These numbers can be infinite and continuous (that is, .01, .02, .03 ... 10.00, 10.01 ... 699.99, 700.00, 700.01...)
Secondary numbers with higher values will be favored over numbers of lesser value.
Although greater values are favored, all values must have some probability of being chosen.

Basically, it's something like a lottery. An entry number comes in (say, 54) along with its value that is being judged (perhaps, 3.04). If 3.04 is among the highest values of all entries, and is chosen, the program should simply notify me that entry 54 has been chosen.

Hopefully I explained that with some clarity... Also, I'm not sure if it is proper for me to request a program as I am new to this forum.

As far as programming languages go, I haven't a preference except whatever would be the easiest for me to run.

Any questions, or if this thread needs to be moved, let me know!
Thanks! :santa: (irrelevant but humorous)
 
A few general points to note with this:

1) You can't have an infinite list, as that would require infinite memory (or disk space depending on your implementation)
2) If you're saying that you will have a finite sized list but with values of infinite range - again this is not possible due to the maximum limit of 2^32 for unsigned integers on 32 bit machines and 2^64 on 64 bit machines (yes the latter is a very large number, but still not infinite). As for floating point / double precision numbers such as your 700.01 etc. these also have limited ranges.

I don't quite follow the premise of the lottery game described in your central paragraph so I can't provide much further detail at this stage. Essentially my only point thus far is be careful with terminology, programmers (rightly so) take specifications very literally and therefore requirements need to be carefully thought-out.
 
What I've gathered so far:
  • Entry number assigned as serial integers, in increment of 1
  • Each entry is given a random value, down to two decimal places, from 0.01 to an undecided number
  • A comparison of value is used to determine the winner, the highest win -- what to do when values equal to each other is undecided
  • Winner is identified by his entry number

As for language, any language can do this really. You just need to decide on what to do with the undecided details mentioned above.
 
Unfortunately, upon further thought I have realized that there are some more factors that will need to be included in this script and I am not able to fully provide the necessary information at this point. Once I have worked out the additional components of the script I'll re-post (this may take some time).

Anyway, thanks for the replies!
 
Are you wanting a weighted random number generator? The simplest way I know to weight random numbers is to take two random numbers where the first result becomes the upper limit of the second. Like this: rnd(rnd(x))
Let x = 3 and the possible results are as follows: 0,0,0,0,1,1,1,2,2,3
 
Back
Top Bottom