Talk:Permutations/Rank of a permutation: Difference between revisions

From Rosetta Code
Content added Content deleted
 
 
(2 intermediate revisions by 2 users not shown)
Line 4: Line 4:


I do like your use of randrange. Neat :-)<br>--[[User:Paddy3118|Paddy3118]] 09:47, 26 October 2012 (UTC)
I do like your use of randrange. Neat :-)<br>--[[User:Paddy3118|Paddy3118]] 09:47, 26 October 2012 (UTC)
:I have changed them back, but kept the unrankers as loops, but kept them as close to the original code as possible.
:By the way, the previous use of <code>randint</code> was wrong. <code>randint(0, perms)</code> generates numbers from 0 to perms (inclusive), like <code>randrange(perms+1)</code>. --[[User:Spoon!|Spoon!]] 04:19, 27 October 2012 (UTC)
::Ah, I understand that now - O read that about randint but failed to notice the significance, Thanks again. --[[User:Paddy3118|Paddy3118]] 08:13, 27 October 2012 (UTC)

==J A.==
I just love it that J has a primitive that has this built in. I'm impressed as I thought twice about creating the task as my Python code was not short and I thought the subject might be too specialized and not attract any interest. The interest of two others is great. (I'll keep an eye out for something with a simple solution that I can turn into a future task too). --[[User:Paddy3118|Paddy3118]] 12:54, 27 October 2012 (UTC)

Latest revision as of 12:54, 27 October 2012

Python: Recursions as iterations

Thanks spoon for making the change, but are we now too far from the Myrvold & Ruskey paper that the functions are based on? An alternative is too add your update as a separate set of examples, but that is up to you - I can go either way.

I do like your use of randrange. Neat :-)
--Paddy3118 09:47, 26 October 2012 (UTC)

I have changed them back, but kept the unrankers as loops, but kept them as close to the original code as possible.
By the way, the previous use of randint was wrong. randint(0, perms) generates numbers from 0 to perms (inclusive), like randrange(perms+1). --Spoon! 04:19, 27 October 2012 (UTC)
Ah, I understand that now - O read that about randint but failed to notice the significance, Thanks again. --Paddy3118 08:13, 27 October 2012 (UTC)

J A.

I just love it that J has a primitive that has this built in. I'm impressed as I thought twice about creating the task as my Python code was not short and I thought the subject might be too specialized and not attract any interest. The interest of two others is great. (I'll keep an eye out for something with a simple solution that I can turn into a future task too). --Paddy3118 12:54, 27 October 2012 (UTC)