XSYLUS
Member
- Joined
- Jan 25, 2008
- Messages
- 5
- Programming Experience
- Beginner
Greetings,
This may have been asked before but I figured I'd throw it out there and see who takes the bait.
I know that computers "technically" do not do random and as a result I've been attempting to work on a program that improves on that limitation.
I've created a simple program using the "roll of a single die" type code where it pulls numbers from 1 to 6 and displays a "random" number everytime the button is clicked.
I've modified that code to show all 6 numbers in a list (or array) like so.
1
2
3
4
5
6
For testing purposes the program displays the above numbers in numerical order as show above, then once the button is clicked it "shuffles" those numbers arround... except, not really. One of the aspects I'm trying to implement into this program is avoiding duplicate numbers.
For example, I want to avoid this type of randomization:
6
2
1
6
4
3
3
As you can see both "6" and "3" are used twice and "4" and "5" are never used.
I basically want to make a program that purposely uses every number only once.
Furthermore the concept is to be able to use such code in an mp3 player so that you can have a bunch of tracks that you want to shuffle and play in a "random" order and you do NOT have to hear the same track twice.
This means the code has to be dynamic enough to detect when new tracks have been added while a track is playing and to "redimention" and include those tracks in the shuffle.
I was hoping to solve this on my own but my programming knowledge and experience is, unfortunately, sub par.
I've been able to write some good programs with the minimal skills I have but for the most part I learn by trial and error and I only vaguely understand some of the functions I'm using.
This may have been asked before but I figured I'd throw it out there and see who takes the bait.
I know that computers "technically" do not do random and as a result I've been attempting to work on a program that improves on that limitation.
I've created a simple program using the "roll of a single die" type code where it pulls numbers from 1 to 6 and displays a "random" number everytime the button is clicked.
I've modified that code to show all 6 numbers in a list (or array) like so.
1
2
3
4
5
6
For testing purposes the program displays the above numbers in numerical order as show above, then once the button is clicked it "shuffles" those numbers arround... except, not really. One of the aspects I'm trying to implement into this program is avoiding duplicate numbers.
For example, I want to avoid this type of randomization:
6
2
1
6
4
3
3
As you can see both "6" and "3" are used twice and "4" and "5" are never used.
I basically want to make a program that purposely uses every number only once.
Furthermore the concept is to be able to use such code in an mp3 player so that you can have a bunch of tracks that you want to shuffle and play in a "random" order and you do NOT have to hear the same track twice.
This means the code has to be dynamic enough to detect when new tracks have been added while a track is playing and to "redimention" and include those tracks in the shuffle.
I was hoping to solve this on my own but my programming knowledge and experience is, unfortunately, sub par.
I've been able to write some good programs with the minimal skills I have but for the most part I learn by trial and error and I only vaguely understand some of the functions I'm using.