Random Number generator for all of you. Also shuffles cards.

fishZombiefishZombie Member, PRO Posts: 46
edited March 2012 in Working with GS (Mac)
I was trying to come up with a solution for creating a random number generator.
Here it is:
http://www.crypes.com/work/RandomSecdTestX2.gameproj.zip
This was a few hard days of work, but it's now very little code. It requires 3 actors, and all you need to do is adjust the Game-Level Attribute of how many numbers there are (1-50) or (5-600). With some tweaking, you can easily make it choose items in a table, or every even number, or whatever. The way it's displayed is so I can see it's using every number given, only once. No repeats. The time delay was solved with the Pusher.
It's extremely well documented. Lot's of notes inside about what each thing does.
the Pusher rules.
I'm not asking $40 for it. If you like it, please donate $1 to bweb@bdowrick.com at paypal. I just saved you a lot of headaches.
for larger number strings (1-1000, or 1-10,000), adjust your Pusher speed. Faster... Stronger... better.....

Comments

  • fishZombiefishZombie Member, PRO Posts: 46
    Actually, I have made some changes to this, again. It works even better now. slower pusher, and pusher mod attribute that speeds things up. Yes.... Slower is Faster. I'm not adding it just yet. I think I can make it even better. I shrank the images down a bit so I can see up to 150 cards now, and I'm shooting for 3 seconds for 500 cards.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    That's fast. I just tried to create a more traditional random number generator that chooses no duplicates from a list and I'm clocking in at 0.2 seconds/number, which is slow (500 numbers would take over two minutes). Haven't had a chance to really digest your rules yet, but I will and then I'll be back with praise.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I changed game.NumbersTotal to 100 and it never generates all 100 cards... do I need to change another attribute's value when I change game.NumbersTotal?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Race footage (timers in yellow; yours on the left, mine on the right; first to 50 wins!):

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • fishZombiefishZombie Member, PRO Posts: 46
    http://www.crypes.com/work/RandomSecdTestX2.gameproj.1.zip
    Yeah, what you did was not allow the cards enough to get delt before the blocker ran into them. This will give you that error of not having the total cards.
    I fixed this, and made it faster.
    As the Pusher moves down the row, he changes the start value of the Random(min,max). I know everything behind him has been eaten, so no it's only choosing numbers in the area between the Pusher, and the end.
    I'm play with two Pushers (one on each end). It make sit super fast, but I really don't see the need for the extra code, and extra actors. I'm not going to shuffle 10,000 cards. Just under 100 is about right for me.
    http://www.crypes.com/work/Random_movie1.mov
    Here is a movie of 150 cards getting sorted. No repeats. You can see the pink ones are random, the White are the Pusher's. Even though it looks like he is eating a lot, the random counter is fast.
Sign In or Register to comment.