Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Generating random permutations

Nikolay SavvinovMar 4 2016 — edited Mar 8 2016

Hi all,

I need to write some code to generate a large number (say, 100k) of permutations of, say, 50 numbers (so, 5M numbers in total), i.e. something like:

set_id   id_within_set position_within_set

1         1                    10                   

1         2                    49

1         3                    26

...

1         50                   36

2         1                    41

2         2                    4

2         3                    33

...

2         50                   50

...        

where there are 100k sets, and position_within_set is an integer random number between 0 and 50, unique within each set.

If anyone could suggest a way how to achieve that within 1-2 seconds, it would be greatly appreciated.

Thanks!

Best regards,

Nikolay

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2016
Added on Mar 4 2016
43 comments
7,683 views