Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Unique Random Numbers

Post any examples or modules that you want to share here

Unique Random Numbers

Postby tulamide » Thu Nov 27, 2014 7:29 pm

Sometimes, random numbers just aren't enough. Imagine you shuffle a deck of cards. They will be in a random sequence then, but each card only appears once. That's exactly what this module, "Unique Random Number Generator", does. It randomizes from a pool of numbers and guarantees that each number will only appear once.

I have good use for it, I hope you'll have use for it, too :D

Download it on Flowstone GURU
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Unique Random Numbers

Postby Exo » Thu Nov 27, 2014 10:25 pm

Thanks, I'm sure I can find a use for it ;)
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Exo
 
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK

Re: Unique Random Numbers

Postby JB_AU » Fri Nov 28, 2014 10:50 am

It's nice, but, it's not that random, there is always the minimum & maximum & previous chosen random numbers in a random order :?
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
JB_AU
 
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Unique Random Numbers

Postby tulamide » Fri Nov 28, 2014 11:02 am

JB_AU wrote:It's nice, but, it's not that random, there is always the minimum & maximum & previous chosen random numbers in a random order :?

I see your point, but that's what the module is about. Just like card shuffling, they also are defined in their value and then shuffled. That's what this module does, too.

So, when giving a range of 20 to 29 with a count of 10 values, you will always get a sequence 20 to 29 but in random order. If you want other values, change min, max and/or count.

Is there any special case, you are thinking about? Because a series of totally random values that guarantees no double values is only achievable with tracking everything that was already spit out. That would be a huge list after some time, taking away a lot of RAM and continously increasing the time needed to check, if the next value was already spit out.

You could give me a scenario and I'll see if it is doable.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Unique Random Numbers

Postby JB_AU » Fri Nov 28, 2014 12:27 pm

capture.png
capture.png (6.42 KiB) Viewed 25398 times
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
JB_AU
 
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Unique Random Numbers

Postby tulamide » Fri Nov 28, 2014 2:26 pm

I confess, I don't understand what you're after. The above can be done with each number only appearing once like this:
randy.png
randy.png (27.37 KiB) Viewed 25393 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Unique Random Numbers

Postby tester » Fri Nov 28, 2014 2:50 pm

Maybe this will clarify some available options.

Case 1: random randomness. Each next number is randomized from a pool (min/max range). Numbers can repeat in a series.

Case 2: unique randomness. Each next number is randomized from a pool, and then excluded from the pool. Numbers never repeat. With finite pool - it's a lottery game. With infinite pool - numbers are just always unique.

Case 3 a/b/c/d: partial randomness. Either certain ranges of the pool can be emphasized (random numbers are taken from there more often - in a regular or random way), or specific numbers are emphasized to be picked up (randomly or m-times per n-hits). Can be used to create a sort of feedback or quasirandomness.

Case 4: source dependent randomness. A sort of input is added, to influence the randomness (soundcard input for example).
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Unique Random Numbers

Postby tulamide » Fri Nov 28, 2014 4:02 pm

tester wrote:Maybe this will clarify some available options.

Case 1: random randomness. Each next number is randomized from a pool (min/max range). Numbers can repeat in a series.

Case 2: unique randomness. Each next number is randomized from a pool, and then excluded from the pool. Numbers never repeat. With finite pool - it's a lottery game. With infinite pool - numbers are just always unique.

Case 3 a/b/c/d: partial randomness. Either certain ranges of the pool can be emphasized (random numbers are taken from there more often - in a regular or random way), or specific numbers are emphasized to be picked up (randomly or m-times per n-hits). Can be used to create a sort of feedback or quasirandomness.

Case 4: source dependent randomness. A sort of input is added, to influence the randomness (soundcard input for example).

Very good summary, tester.

Additionly from me: While Ruby's standard random class offers case 1, my module offers case 2, with case 3 possible through chaining/mixing several instances of my module.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Unique Random Numbers

Postby adamszabo » Sat Nov 29, 2014 3:11 pm

I think the problem with the schematic is that it seems its not really random. For example when I set the range between 0 and 1 i get 0.1111, 0.2222, 0.3333 and so on. so it seems its dividing by the number you specify. It would be truly random if it writes: 0.1111 then, 0.111253. Its close to 0.111 but still a different value, if you understand what I mean.
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Unique Random Numbers

Postby tulamide » Sat Nov 29, 2014 5:22 pm

adamszabo wrote:I think the problem with the schematic is that it seems its not really random. For example when I set the range between 0 and 1 i get 0.1111, 0.2222, 0.3333 and so on. so it seems its dividing by the number you specify. It would be truly random if it writes: 0.1111 then, 0.111253. Its close to 0.111 but still a different value, if you understand what I mean.

I know what you mean, but that's not the intention of this module. In your example, you get 0.1111, 0.2222, etc., because of the count of numbers you entered. Example:
min 1, max 2, count 2 will return either 1 or 2 in random order
min 1, max 2, count 3 will return 1, 1.5 and 2 in random order
min 1, max 2, count 4 will return 1, 1.3333, 1.6666, 2 in random order
min 1, max 2, count 5 will return 1, 1.25, 1.5, 1.75, 2 in random order
and so on

So don't ignore count, it defines the count of numbers you want to get returned. done triggers, when count numbers are returned, so you can then generate a new sequence.

Again, imagine a card deck. It has a fixed number of cards, like 32 or 54 or w/e, those cards then are shuffled so that they appear in random order, with each card of the deck appearing exactly once. count is like defining the size of the deck, min and max are defining the range of numbers that is evenly distributed over the cards, and start is the equivilent of shuffling the cards. request next in this analogy is the dealer giving you a card.

Back to your example: That's the intention of the module. Not the numbers are random (you define them with min, max and count) but the order in which they appear. That's what this module is about.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 48 guests