text:
Please release me!
As code-golfers, we're not used to releasing (surely). We're gonna need a few tools to help us do that.
Of course, to help marketing a new release, we need a nice and shiny Release Version. Who doesn't get excited when they hear about version 3.0.0?
Task
Your task will be to write a program/routine/... to increment a version number.
You need to increment the version number and reset the "less important" ones (i.e. patch version).
You get two arguments: the current version (ex "1.0.3") as a string, and an index to know which one to update (0 or 1-indexed).
Example, 0-indexed:
next-version("1.0.3", 0) # 2.0.0
next-version("1.2.3.4.5", 2) # 1.2.4.0.0
next-version("10.0", 0) # 11.0
next-version("3", 0) # 4
next-version("1", 7) # ERROR
next-version("01", 0) # ERROR

The version is a string, each part is a number, separated with a dot. There can be no leading, no trailing or no consecutive dots (and nothing outside of numbers/dots). There is no limit to the size of the version string.
^[1-9]\d*(\.[1-9]\d*)*$
The error case (last two examples) is undefined behavior. What happens in case of wrong inputs is of no relevance to this challenge.
As usual, standard loopholes are forbidden. You're allowed to print or return the string.

Can we ask to receive as input first the index and then the version number?

@Leo yes, the order is not an issue.

I might add a test case for incrementing the final number in the string, or an example or something to test for.

@nmjcman101 how is it a special case?

@ven It's not a special case, there just aren't any cases incrementing the last one, and I thought it could help someone else.

I wish I could make the same challenge with the win condition as "most readable" so someone would write these for me to use in real work. =)

@jpmc26 I have xyz.pm6 on github, the module I extracted this idea from! I actually use it.

You are reminding me of an argument over whether the semantic versioning standard required decimal numbers, or allowed other bases. Thanks for providing a regex to make your spec unambiguous.

Well, mostly unambiguous. Your regex allows 1.0.009 and most of the solutions would not "correctly" increment that to 1.0.010

so close! you still allow 000.1.2.3 :)

Awww. Okay, fixed again. :P

Japt, 16 11 bytes
¡V«´V+ÂX}'.

Test it online! Input number is 1-indexed.
Based on my JavaScript answer. This takes advantage of one of Japt's most helpful features: splitting one string on another before mapping each item, then joining on that string again after mapping.
Ungolfed and explanation
¡  V«  ´ V+Â X}'.
Um@V&&!--V+~~X}'.
                   Implicit: U = input string, V = input number
Um@           }'.  Split U at periods, then map each item X by this function:
   V&&               If V is 0, return V.
      !--V+~~X       Otherwise, decrement V and return X + !V (increments X iff V was 1).
               '.  Re-join the result with periods.
                   Implicit: output last expression

A sweet feature indeed!

Well drat, I thought I had it in the bag. Excuse me, I'm gonna go obsess over my V answer and squeeze every last little byte out of it. :P

JavaScript (ES6), 44 42 40 37 bytes
Saved 3 bytes thanks to @Neil
x=>i=>x.replace(/\d+/g,n=>i&&+n+!--i)

Input number is 1-indexed.
Test snippet

f = x=>i=>x.replace(/\d+/g,n=>i&&+n+!--i)

console.log(f("1.0.3")(1))
console.log(f("1.2.3.4.5")(3))
console.log(f("10.0")(1))
console.log(f("1")(8))

Crossed out 44 is still 44 :)

@KritixiLithos What is wrong with my browser? http://cubeupload.com/im/ofJySU.png

n=>i&&+n+!--i

@Neil Thanks! I just couldn't figure out how to golf that expression any further...

Vim 20 25 bytes
I unfortunately realized that it didn't handle the case of updating the last number, so I had to add bytes. This is 1-indexed.
DJA.0@"t.qq2wcw0@qq@qx

TryItOnline
Unprintables:
DJA.^[0@"t.^Aqq2wcw0^[@qq@qx

This takes the arguments in reverse order, as separate lines:
3
1.2.3.4.5

Explanation:
DJ                           # Delete the input argument, and join lines
  A.^[0                      # Add a period to the end
       @"t.                  # Move to the "Copy register"th period
           ^A                # Increment the number under the cursor
             qq       @qq@q  # Until an error
               2w            # Move the cursor forward to the next number
                 cw0^[       # Change the number to 0
                           x # Delete the last '.'

Nice! An explanation would be helpful

@KritixiLithos Added.  Unfortunately I had to add some bytes also to handle incrementing the final version number, but it happens.

I think if you went 0-indexed, you could just do DJ@"t.<C-a>qq2wcw0<esc>@qq@q which is back down to twenty

@DJMcMayhem I don't think I can do that because then I wouldn't be able to differentiate 0 and 1.

Oh yeah, good point. How about DJ@"f.@"<esc><C-a>qq2wcw0<esc>@qq@q ?

@DJMcMayhem I upvoted that comment because I really wanted a way to be able to have count be 0, and that's genius, but in this case won't work because it changes the last number to 0 when I record the macro.  It doesn't in my current version, because it changes the extra '.' to 0, and then deletes it

V, 13, 12 bytes
Àñf.ñò2wcw0

Try it online!
This is 0-indexed.
There is a ctrl-a (ASCII 0x01) in there, so here is a readable version:
Àñf.ñ<C-a>ò2wcw0

Explanation:
À                   " 'arg1' times
 ñ  ñ               " Repeat the following:
  f.                "   Move to the next '.' character
     <C-a>          " Increment the next number
          ò         " Recursively:
           2w       "   Move two words forward
              cw    "   Change this word
                0   "   to a '0'

Perl, 40 37 34 + 1 = 35 bytes
-2 bytes thanks to @Dada.  -3 bytes thanks to an idea I got from reading @ETHproductions's Japt code.
Run with the -p flag.
$a=<>;s/\d+/$a--<0?0:$&+!($a+1)/ge

Try it online!
Breakdown of the code
-p          #Wraps the program in a while(<>){ ... print$_} statement.
            #Input is read into the $_ variable
$a=<>;s/\d+/$a--<0?0:$&+!($a+1)/ge
$a=<>;                              #Reads the version update into $a
      s/   /                   /ge  #Substitution regex:
                                g   #Repeats the substitution after first match
                                 e  #Interprets replacement as Perl code
       \d+                          #Matches 1 or more digits, and stores match in $&
                  ? :               #Ternary operation
            $a--<0                  #Checks if $a is negative and then decrements $a
                  ?0                #If negative, we've passed our match; print 0 instead
                    :$&+!($a+1)     #Otherwise, we're either printing $& + 0 (if $a was positive) or $& + 1 (if $a was 0).
#Since substitution implicitly modifies $_, and -p prints $_, it prints our answer

Remove all those parenthesis on both sides! (and $& instead of $1 then)

I knew I was missing something! Thanks!

Using 1-indexed numbers can save 4 bytes: Try it online!

C# 116 104 Bytes
using System.Linq;(v,i)=>string.Join(".",v.Split('.').Select(int.Parse).Select((x,n)=>n==i?x+1:n>i?0:x));

Explanation
using System.Linq;(v,i)=>   //Anonymous function and mandatory using
    string.Join(".",                    //Recreate the version string with the new values
        v.Split('.')                    //Get individual pieces
            .Select(int.Parse)          //Convert to integers
                .Select(
                    (x,n)=>             //Lambda with x being the part of the version and n being the index in the collection
                        n==i
                            ?x+1        //If n is the index to update increment x
                            :n>i        //Else if n is greater than index to update
                                ?0      //Set to zero
                                :x));   //Otherwise return x

Try it here

You don't need the string and int in the anonymous function signature

@TheLethalCoder ahh yes of course, thanks.

Python 2, 84 Bytes
I feel like this could really be shorter.. Might need a way to have a non-enumerate option.
lambda s,n:'.'.join(str([-~int(x)*(i==n),x][i<n])for i,x in enumerate(s.split('.')))

If we were able to take the version as a list of strings, there's a 75-byte solution:
g=lambda s,n:(str(-~int(s[0]))+'.0'*~-len(s))*(n<1)or s[0]+'.'+g(s[1:],n-1)

Furthermore, if both the input and output were lists of numbers, there's a 64-byte solution:
g=lambda s,n:([-~s[0]]+[0]*~-len(s))*(n<1)or [s[0]]+g(s[1:],n-1)

Jelly, 19 17 bytes
ṣ”.V€‘⁹¦µJ’<⁹×j”.

1-indexed.
TryItOnline!
How?
ṣ”.V€‘⁹¦µJ’<⁹×j”. - Main link: currentVersion, theIndex
ṣ”.               - ṣplit left (currentVersion) at occurences of '.'
   V€             - eVal €ach (creates a list of integers)
      ⁹           - right argument (theIndex)
       ¦          - apply to given index(es)
     ‘            -    increment
        µ         - monadic chain separation (call the above result z)
         J        - range(length(z))  i.e. ([1,2,3,...,length])
          ’       - decrement         i.e. ([0,1,2,...,length-1])
            ⁹     - right argument (theIndex)
           <      - less than?        i.e. ([1,1,...,(1 at theIndex),0...,0,0,0]
             ×    - multiply by z (vectortises) - zeros out all of z after theIndex
              j”. - join with '.'

Congrats on 10k!!

Can't wait for Jelly 2.0 so you can get rid of that V€ :).

@LuisMendo - thanks! I'm so unobservant (Dennis noticed my 1K milestone before I did too).

MATLAB, 85 bytes
function f(s,j);a=split(s,'.');a(j)=string(double(a(j))+1);a(j+1:end)='0';join(a,'.')

One based, and first attempt at golf!

Well done! First time I see the new string type in action :-)

Perl 6, 67 bytes, 0-indexed
->$v,$i {$v.split('.').map({++$>$i??($++??0!!$_+1)!!$_}).join: '.'}

Explanation:
->$v,$i {$v.split('.').map({++$>$i??($++??0!!$_+1)!!$_}).join: '.'}
->$v,$i {                                                         } # function taking version/index to increment
         $v.split('.')                                              # split by dot
                      .map({                          })            # for each version number
                            ++$>$i??                                # if an anonymous variable ($), incremented,
                                                                    #  is greater than $i (index to increment)
                                    ($++??       )                  # if it's not the first time we've been over $i
                                                                    # (using another anonymous value, which gets default-init'd to 0)
                                          0                         # then 0 (reset lower version numbers)
                                           !!$_+1                   # otherwise, increment the number at $i
                                                  !!$_              # otherwise return the number part
                                                        .join: '.'  # join with a dot

Just fyi, self answers are totally eligible. In fact, they're even encouraged

@DJMcMayhem I knew about this, but I thought they were not eligible

V 14 20 bytes
Again, I had to add code for the corner case of incrementing the final digit.
(1-indexed)
DJA.0@"t.ò2wcw0òx

TryItOnline
Unprintables:
DJA.^[0@"t.^Aò2wcw0^[òx

This takes the arguments in reverse order, as separate lines:
3
1.2.3.4.5

Nice answer! I'm always happy to see someone else use V! Just so you know, if you put the first input in 'args', it will predefine register 'a' to that number, so you could do @a (or even shorter, À) which should save you a bunch of bytes.

Batch, 119 bytes
@set s=%1
@set i=%2
@set t=
@for %%i in (%s:.=,%)do @set/an=!!i*(%%i+!(i-=!!i))&call set t=%%t%%.%%n%%
@echo %t:~1%

1-indexed.

PowerShell 3+, 75 74 bytes
($args[0]-split'\.'|%{$m=!$b;$b=$b-or$args[1]-eq$i++;(+$b+$_)*$m})-join'.'

Ungolfed
(
    $args[0] -split '\.' |
        ForEach-Object -Process {
            $m= -not $b
            $b = $b -or ($args[1] -eq $i++)
            (([int]$b) + $_) * $m
        }
) -join '.'

Explanation
Parameters are accepted using the $args array.

Split the version string on ., then for each element:

$m is set to be -not $b. On first run, $b will be undefined which will be coalesced to $false, so $m will start as $true. $m is intended to be a multiplier that's always 0 or 1 and it will be used later. $m must be evaluated here because we want it to be based on the last iteration's $b value.
$b is set to itself -or the result of comparing an iterator $i with $args[1] (the index parameter). This means $b will be set to $true here once we're on the element that is to be incremented. Additionally, it will be $true in every subsequent iteration because the conditional is -or'd with its current value.
$b is converted to a number using unary + ($false => 0, $true => 1), then added to the current version element $_ which is a [string], but PowerShell always tries to coalesce the argument on the right to the type on the left, so arithmetic will be performed, not string concatenation. Then this value will be multiplied by $m, which is still [bool] but will be implicitly coalesced.

Re-join the resulting array with ..

So, the first iteration where $b becomes $true, $b would have been $false when $m was evaluated, making $m equal $true, which will keep the multiplier at 1.
During that run $b becomes $true and is added to the version element (as 1), thereby incrementing it, and since the multiplier is still 1, that will be the end result.
So on the next iteration, $b will already be $true, making $m equal $false, which will make the multiplier 0. Since $b will forever be $true now, the multiplier will always be 0, so every element returned will be 0 too.

PHP, 81 bytes
awfully long. At least: the Elephpant still beats the Python.
foreach(explode(".",$argv[1])as$i=>$v)echo"."[!$i],($i<=$n=$argv[2])*$v+($i==$n);

loops through first argument split by dots: "."[!$i] is empty for the first and a dot for every other element;
($i<=$n) and ($i==$n) are implicitly cast to integer 0 or 1 for integer arithmetics.

R, 100 95 92 86 bytes
Unusually for R, this uses 0-indexing. Anonymous function with two arguments (a string and an integer). Likely can be golfed down a tad.
function(v,i)cat((x=scan(t=el(strsplit(v,"\\."))))+c(rep(0,i),1,-x[-(0:i+1)]),sep=".")

05AB1E, 22 bytes
'.¡vy²N‹i0*}²NQi>})'.ý

Try it online!
I don't know how to do if-else in 05AB1E, so this is longer than it should be.

If I'm not misunderstanding, I don't think this works. The question says you have to 0-out the minor versions, so 1.0.0.0.3, 3 should produce 1.0.0.1.0 not 1.0.0.1.3.

@LambdaBeta misread, fixed.

Coffee-script: 77 67 Bytes
f=(p,i)->((z<i&&v||z==i&&~~v+1||0)for v,z in p.split '.').join '.'

Woot! Time for cake and coffee for the beta release.
Thanks to @ven and @Cyoce I shaved 10 Bytes!

Nice! Not sure you need the parseInt here though?

Btw you can save two bytes by using parenless calls (i.e. .join '.' or .split '.')

Use + instead of parseInt (use ~~ if you need it to be cast to integer)

Python 3, 89 86 bytes
lambda v,c:'.'.join((str((int(x)+1)*(i==c)),x)[i<c]for i,x in enumerate(v.split('.')))

very naive way of getting things done
Edit: rewritten the conditional by referring to @kade

JavaScript (ES6), 57 55 bytes
(s,x)=>s.split`.`.map((j,i)=>i==x?+j+1:i>x?0:j).join`.`

Examples:

n=(s,x)=>s.split`.`.map((j,i)=>i==x?+j+1:i>x?0:j).join`.`

console.log(n('1.0.3', 0))
console.log(n('1.2.3.4.5', 2))
console.log(n('10.0', 0))
console.log(n('3', 0))
console.log(n('1', 7))

Not the best JS implementation but it's fairly simple and follows the logic you'd expect.

Okay, that wasn't terribly clear, thanks.

LiveScript, 53 52 bytes
->(for e,i in it/\.
 [+e+1;0;e][(i>&1)+2*(i<&1)])*\.

-1 byte thanks to @ASCII-only!
Old Explanation:
(a,b)->x=a/\.;x[b]++;(x[to b] ++ [0]*(x.length-1-b))*\.
(a,b)->                                                 # a function taking a and b (version and index)
       x=a/\.;                                          # split a on dot, store in x
              x[b]++;                                   # increment at the given index
                     (x[to b]                           # slice be from 0 to the index
                              ++                        # concat (both spaces are necessary so it's not interpreted as an increment operator
                                 [0]*(x.length-1-b))    # with enough zeros to fill the array back to its original size (x's size)
                                                    *\. # join on dot

Another self-answer... Not that anyone golfes in LiveScript anyway. :P
I was working on another version:
(a,b)->(a/\.=>..[b]++;..[b to *]=0)*\.

But * is too overloaded to be recognized in a splicing index, thus =0 will try to access 0[0]. So you need to write something like ..[b to ..length- b]=[0]*(..length-1-b) and it's longer in the end.

sadly f=(a,b)->(for e,i in a/\.<newline>  if i<b then e else if i>b then 0 else+e+1)*\. is way longer :(

@ASCII-only I think it's possible to compress if i<b then e else if i>b then 0 else+e+1 in i.e. [+e+1;0;e;e][i>b+(2*i<b)] or something along those lines, maybe even ([+e;-1][i>b+(2*i<b)]||e-1)+1

(a,b)->(for e,i in a/\.<newline> [+e+1;0;e][(i>b)+2*(i<b)])*\., 54

Then let's remove the signature: ->(for e,i in it/\.<newline> [+e+1;0;e][(i>&1)+2*(i<&1)])*\. for 52

btw you can replace ; with space. also... looks like that's basically as far down as it'll go with this approach

I mostly remember how the lexer works, yeah :D. Kinda wish we had implemented <=> now.

Powershell, 80 100 95 92 Bytes
Saved 5 bytes by using a const for the -1..if
Saved 3 bytes by using !$b instead of $b-eq0
filter x($a,$b){[int[]]$y=$a.Split('.');-1..((-$b,-1)[!$b])|%{$y[$_]=0};$y[$b]++;$y-join'.'}

Explanation:
filter x($a,$b){
    [int[]]$y=$a.Split('.') #Split input into integer array
    $y[$b]++ #Increment 'major' version no. ($b) by one
    -1..((-$b,-1)[!$b])|%{$y[$_]=0} #Set all trailing numbers to 0, now also checks for $b=0 cases.
    $y-join'.' #Join back into '.' seperated Array
}

Test Cases:
x "1.0.3" 0
x "1.2.3.4.5" 2
x "10.0" 0
x "1" 7
2.0.0
1.2.4.0.0
11.0
Index was outside the bounds of the array.

Nice! I love seeing more powershell here.

@briantist honestly a lightweight uncompiled version of C# which can interface with everything is a godsend, I deal with a lot of Microsoft stuff at work and absolutely love it.

Oh absolutely; PowerShell is my jam, but not a lot of people think to use it for golfing. It has some features that are great for golfing, and others that make it suck for golfing, but overall it's a solid choice! I'm toying with the idea of doing a presentation about golfing in PowerShell at my next PSUG.

@briantist the default aliases are beautiful, but I'd love to be able to use a pre-defined set of a few common commands as single char aliases f for golfing, if say it could compete with some actual golfing languages if we could use r instead of random

Funny thing about random, it's not an an alias! It's a result of PowerShell's command evaluation. As it looks to find a command in aliases, functions, cmdlets, native applications, etc., the very last thing it tries to do is prepend Get- to whatever it is. So you're actually calling Get-Random, but technically not as an alias. You can see this working by running service, or childitem, or for maximum irony, alias.

Damn, good to know, that's an easy 4 byte save per command.

Yeah, but the trick is that if the name corresponds to a different statement or native command, it won't work. So process ends up being interpreted as a Process {} block (I think), date calls the OS native command (it would have been really useful in this challenge).

classic microsoft, one big mix of exceptions to the rule.

This doesn't work for single-digit version inputs, like the test case x "3" 0, which here returns 1 instead of 4.

Objective-C 531 Bytes
#import<Foundation/Foundation.h>
int main(int argc,const char *argv[]){@autoreleasepool{NSString *s=[NSString stringWithUTF8String:argv[1]];NSInteger n=strtol(argv[2],NULL,0);NSArray *c=[s componentsSeparatedByString:@"."];if(c.count<=n)NSLog(@"ERROR");else{int i=0;NSMutableString *v=[[NSMutableString alloc]init];for(;i<n;++i)[v appendFormat:@"%@.",[c objectAtIndex:i]];[v appendFormat:@"%li", strtol(((NSString *)[c objectAtIndex:i++]).UTF8String,NULL,0)+1l];for(;i<c.count;++i)[v appendString:@".0"];NSLog(@"%@",v);}}return 0;}

compile:
clang -fobjc-arc -Os main.m -o main

usage:
./main 1.2.3 1

Welcome to CodeGolf. In the title, You should tell the size of the source code, not the byte code. And the source should, of course, be as short as possible (no unnecessary whitespace, single character variable names etc.). Good Luck.

can probably use 0 instead of NULL and remove the return 0; at the end of the main. NSString *s can probably have the space removed. **argv is 1 byte shorter than *argv[]. @autoreleasepool{} is probably unnecessary.

447 bytes (TIO doesn't seem to have the objc runtime installed)

Javascript ES6: 60 bytes
n.split(".").map((n,r)=>{return r>i?n=0:n}).join("."),n[i]++}

Welcome to PPCG! This doesn't seem to be valid, as it is does not take input in any way, and there is an extra } at the end. On golfing: one of the features of arrow functions is implicit return, so you can replace (n,r)=>{return r>i?n=0:n} with (n,r)=>r>i?n=0:n to save some bytes.

R, 75 bytes
f=function(a,b){n=scan(t=a,se=".");m=-n;m[b]=1;m[1:b-1]=0;cat(n+m,sep=".")}

Indexing is 1-based. You can play with it online here.

APL (Dyalog), 31 bytes
Requires ⎕IO←0 (Index Origin 0), which is default on many systems. Full program body; prompts for text input (version) and then numeric input (index).
' '⎕R'.'⍕⎕(⊢∘≢↑↑,1+⊃)⊃⌽'.'⎕VFI⍞

Try it online!
⍞ prompt for text input
'.'⎕VFI Verify and Fix Input using period as field separator (fields' validities, fields' values)
⌽ reverse (to put the values in front)
⊃ pick the first (the values)
⎕(...) apply the following tacit function to that, using evaluated input as left argument:
To explain the non-tacit equivalents of each function application we will now use ⍺ to indicate the left argument (the index) and ⍵ to indicate the right argument (the list of individual numbers of the originally inputted current version number).
 ⊃ equivalent to (⍺⊃⍵) use ⍺ to pick an element from ⍵
 1+ add one to that
 ↑, equivalent to (⍺↑⍵), prepend ⍺ numbers taken from ⍵
 ⊢∘≢↑ equivalent to (⍺⊢∘≢⍵)↑ equivalent to (≢⍵)↑ take as many numbers from that as there are elements in ⍵, padding with zeros if necessary
⍕ format (stringify with one space between each number)
' '⎕R'.' PCRE Replace spaces with periods

Java 8, 130 bytes
s->n->{String r="",a[]=s.split("\\.");for(int l=a.length,i=-1;++i<l;)r+=(i>n?0:new Long(a[i])+(i<n?0:1))+(i<l-1?".":"");return r;}

Explanation:
Try it here.
s->n->{                 // Method with String and Integer parameters and String return-type
  String r="",          //  Result-String
  a[]=s.split("\\.");   //  String-array split by the dots
  for(int l=a.length,   //  Length of the array
      i=-1;++i<l;)      //  Loop from 0 to `l` (exclusive)
    r+=                 //   Append the result-String with:
       (i>n?            //    If index `i` is beyond input `n`:
        0               //     Append a zero
       :                //    Else:
        new Long(a[i])  //     Convert the current String to a number
        +(i<n?          //     If index `i` is before input `n`
           0            //      Leave the number the same by adding 0
          :             //     Else:
           1))          //      Add 1 to raise the version at index `n`
       +(i<l-1?         //    If we've haven't reached the last iteration yet:
          "."           //     Append a dot
         :              //    Else:
          ""            //     Append nothing
   );                   //  End of loop
   return r;            //  Return the result-String
}                       // End of method

Haskell, 136 129 bytes
import Data.List.Split
import Data.List
f s n|(x,z:y)<-splitAt n(splitOn "."s)=intercalate "."(x++[show$read z+1]++map(\_->"0")y)

Try it online!

Original

128

Pyth - 21 bytes
j\.++<Kcz\.Qhs@KQmZ>K

Test Suite

No, this isn't quite correct. Your 10.0 test case gives 11.0.0, that's one too many part!


text:
Make me a fake loader
Make a fake loader just like this :

Parameters :

Display loading (space) one of these cyclically-\|/ (space) (percentage counter from 0-100) then a %.
The percentage counter is supposed to increment by 1 every time the display changes.
The time taken by counter to jump to next iteration is random. Any kind of random will do as long as the function/method is capable of generating all random integers having probability > 0 in range 1<= ms <=750 here ms being time in milliseconds.
Start at loading - 0 %.
End at loading - 100 %.
NO INPUT is required.
submit a full program or function or whatever similar.

The code that I used :
C++
#include<stdio.h>
#include<time.h>
#include<windows.h>

int main()
{
    srand(time(NULL));
    char a[15],b[]="-\\|/";
    int i=0,j=0,ms;
    while(j<101)
    {
        (i<3)?i++:i=0;
        wsprintf(a,"loading %c %d ",b[i],j++);
        printf(a);puts("%");
            //This part is to make the output look cool
        switch(rand()%9)
        {
            case 0:ms=1;break;
            case 1:ms=2;break;
            case 2:ms=5;break;
            case 3:ms=10;break;
            case 4:ms=15;break;
            case 5:ms=20;break;
            case 6:ms=25;break;
            case 7:ms=50;break;
            case 8:ms=500;
        }
        Sleep(ms);  //Otherwise this is supposed to be random
        if(j<101)   //like this Sleep(rand()%750+1);
        system("cls");
    }
}

Winner

the code with least bytes wins.

Related

I didn't think this was a duplicate. This question cannot be implemented in ><>, but can be in *><> for example. I quite liked it.

@Mego The question isn't a duplicate. The output is a little different, the runtime is completelly different and the output requires a random time instead of a fixed 250ms delay. Answers on one question can't be used on the other without heavy modification. Please, read the questions.

As the author of the other challenge I'll step in with the dupe debate. Although the cycling chars (\|/-) are the same, the answer seems to be different in that it is not infinite and involves generation of random numbers, rather than a static output. Therefore I'll say, although I initially felt copied, this doesn't look like a dupe to me.

@flp.tkc this idea came from many places combined like I saw -\|/ in some games.And I was inspired from console installation programs.

Are 1..750ms an exact, a maximal or a minimal range of numbers that we should generate for the delay?

@Titus If you know c-related languages then this should clarify your doubt rand ()%750+1.

My issue is that in PHP rand() returns an integer; and you cannot delay by milliseconds: it´s either seconds or microseconds. So: would [1..750k] microseconds be ok? or [1..1mill] microseconds?

@Titus Sure that's ok [1,750K] is acceptable. And a v.important point has been clarified i.e. the time-delay is in milliseconds.

MATL, 45 bytes
101:"'loading'O'-\|/'@)O@qVO37&hD750Yr100/&Xx

Example run in the offline compiler:

Or try it at MATL Online!
Explanation
101:          % Push array [1 2 ... 101]
"             % For each
  'loading'   %   Push this string
  O           %   Push 0. When converted to char it will be displayed as a space
  '-\|/'      %   Push this sring
  @)          %   Modular index into this string with iteration index
  O           %   Push 0
  @q          %   Iteration index minus 1
  V           %   Convert to string
  O           %   Push 0
  37          %   Push 37, which is ASCII for '%'
  &h          %   Concatenate horizontally into a string, Numbers are converted to char
  D           %   Display
  750Yr       %   Random integer with uniform distribution on [1 2 ... 750]
  100/        %   Divide by 100
  &Xx         %   Pause that many tenths of a second and clear screen
              % End (implicit)

Powershell, 71 68 65 Bytes
Similar to https://codegolf.stackexchange.com/a/101357/59735
Saved 3 bytes by not being an idiot (left the ... on loading)
-3 thanks to VisualMelon
changed 750 -> 751 to make sure 750 is included.
0..100|%{cls;"loading $("|/-\"[$_%4]) $_ %";sleep -m(random 751)}

Explanation:
0..100|%{                                  #For range 0-100...
    cls                                    #Clear Display
    "loading $("|/-\"[$_%4]) $_ %"    #Display the current string
    sleep -m(random 750)                  #Sleep random ms up to 750
}

Updated gif

your output is not exactly same please see my gif and correct yours

I think you can drop the space after -m, and lose the parentheses around $_%4 (seems to work on my box at least).

@VisualMelon thanks, the () were leftover from the other challenge I straight copied my code from.

Python 2, 119 113 112 Bytes
I had originally gone with the random amount being random()/.75, however the endpoint wouldn't be included. There isn't much difference from this to the other question for the infinite load time except for the randomness and the fact that it actually ends.
import time,random as r
for i in range(101):print'\rLoading','-\|/'[i%4],i,'%',;time.sleep(r.randint(1,750)/1e3)

thanks to Jonathan Allan for saving 6 bytes, and DJMcMayhem for saving a byte!

Save 6 bytes with import time,random as r and r.randint.

@JonathanAllan Didn't realize you could import like that, thanks!

A for loop is slightly shorter: for i in range(101):print'\rLoading','-\|/'[i%4],i,'%',;time.sleep(r.randint(1,750)/1e3)

@DJMcMayhem Whoops, I had been testing it with range(1,101) for some reason..

Acttually, I found something another 3 bytes shorter: i=0;for c in'-\|/'*25:print'\rLoading',c,i,'%',;time.sleep(r.randint(1,750)/1e3);i+=1

@DJMcMayhem Ooh, fancy ;) Thanks!

@DJMcMayhem although that will end at 99% :(

@JonathanAllan Didn't think of that, I reverted my answer.

@Kade Looking at the rules you don't have to include 750 as a possible sleeping value as the comments under the question (and the sample code) say that it doesn't have to be uniform. So random()/.7 should be valid and shorter.

@matsjoyce The example code has the 'cool bonus' in it, in the comments it does clearly state the normally used code which implies a value 1 <= x <= 750 to be generated. Also, dividing by a decimal will produce a sleep value over rather than under it. Even then, it isn't as simple because if random() decides to be 0.00005 I am now attempting to call sleep for under a millisecond, which isn't valid.

Incidentally, at this point in golfing, import time,random as r and r.randint don't save you any bytes from just using import time,random and random.randint.

The last comma in print'\rLoading','-\|/'[i%4],i,'%', is unnecessary.

@Rainbolt that doesn't seem to be the case.

*><> (Starfish), 86 82 bytes
| v1*aoooooooo"loading K"&0"-\|/"
!0x1! +
%$<.0+af{od;?)*aa&:&Soono$&+1:&"  %"{o:}

Try it here!
This may be able to be golfed more, but I don't see anything super obvious. It sleeps 100ms, 400ms, or 700ms, if this isn't random enough, let me know!
Thanks to @TealPelican for saving me 4 bytes and making it much more random!
The biggest challenges I found (while still trying to keep it small) were randomness, and actually outputting "loading - 100 %" at the end, instead of just exiting at my nearest convenience :p.

Hey, I love this take on the ><> language, it opens up a lot more challenges :D - I've had a bit of a tweak on your code and I've not reduced it by much but changed the random numbers. Link to ><> code The only change to make this viable in *><> would be changing the ~ from the code link to S to use the time. This does generate random numbers all the way up to 749 and cuts out some excess stack operations. P.S I'd love it if you could make *><> online interpreter :D

@Tealpelican, thanks! I love your changes, especially the random number generator! I'd also love an online *><> interpreter :p. I don't play around with JS too often, but I'll both look into playing with JS, or maybe running the Go interpreter through GopherJS first for a head-start. :)

Thanks, it took a while to actually come up with a working version but this seems the mosted golfed I could generate. I'll keep my eye out for it and if not may dabble into making a python one. I still think the first line could be golfed a bit more but I haven't been able to do it myself.

@Tealpelican hopefully this fills the online interpreter itch, or at least gets the ball rolling. I'm going to look into a way to share code later. https://starfish.000webhostapp.com/

That was quick, just running the program in it now and seems to work fine :D I'm going to try have a look at using this for some challenges this week.

@Tealpelican awesome I look forward to that! I just added a share feature, which I hope is okay (just does text compression).

Batch, 185 bytes
@set s=-\!/
@for /l %%i in (0,1,100)do @call:l %%i
@exit/b
:l
@cls
@set c=%s:~0,1%
@set s=%s:~1%%c%
@echo Loading %c:!=^|% %1 %%
@set/aw=%random%%%751
@ping>nul 1.1 -n 1 -w %w%

The timing is fairly poor unfortunately, but Batch doesn't have anything better to use than ping.

This only works on Windows.  FreeCom DOS batch gives Loading   % Invalid switch. - /aw    (I would love to try it in MS DOS if I can still find my copy).

@BrianMinton: Good luck running it on MS DOS (no ping command)

@BrianMinton It requires CMD.EXE because of the advanced variable substitutions.

@Joshua Well, not built in at least; that didn't happen until Windows 2000.

Perl 6, 67 bytes
for |<- \ | />xx* Z 0..100 {print "\rloading $_ %";sleep .750.rand}

Expanded:
for

  # produce a list of all the pairs of values

  |<- \ | /> xx *   # a flat infinite list of "clock faces"
  Z                 # zipped with
  0 .. 100          # all the numbers from 0 to 100 inclusive

  # &zip / &infix:<Z> stop on the shortest list

{

  # ｢$_｣ will look something like ｢("/", 39)｣
  # when it is coerced to a Str, all of its elements
  # will be coerced to Str, and joined with spaces

  print "\rloading $_ %";

  sleep .750.rand

}

Javascript (ES6), 128 118 116 115 112 110 109 bytes
This seems to work perfectly fine, even with this sketchy source of "random" numbers.

(X=_=>setTimeout(i>99||X,1+new Date%750,document.body.innerHTML=`<pre>Loading ${'-\\|/'[i%4]} ${i++}%`))(i=0)

Alternative 1, Javascript + HTML, 16 + 84 bytes
This one uses an already-existing element to display the remaining content:

(X=_=>setTimeout(i>99||X,1+new Date%750,a.innerHTML=`${'-\\|/'[i%4]} ${i++}%`))(i=0)
Loading <a id=a>

Alternative 2, 95 bytes
If I can assume a tab is opened and that you're pasting this into the console:
(X=_=>setTimeout(i>99||X,1+new Date%750,document.title=`Loading ${'-\\|/'[i%4]} ${i++}%`))(i=0)

Instead of showing the HTML, the title of the document will change.

Thank you to @user2428118 for saving 2 bytes!

You can drop the () after Date to save two bytes.

@user2428118 I didn't knew that that works! Thank you for the tip.

F#, 118 bytes
async{let r=System.Random()
for i in 0..100 do printf"\rLoading %O %d %%""|/-\\".[i%4]i;do!Async.Sleep(r.Next(1,750))}

In order to run this snippet, pass it into Async.Start or Async.RunSynchronously.

Instant upvote because of F#

PHP, 90 83 80 78 77 Bytes
77:
The closing ; is not needed.
for(;$i<101;usleep(rand(1,75e4)))echo"\rloading ",'-\|/'[$i%4],' ',$i+++0,'%'

78:
While looking for another workaround to get a 0 initially without initializing the variable I came up with this:
for(;$i<101;usleep(rand(1,75e4)))echo"\rloading ",'-\|/'[$i%4],' ',$i+++0,'%';

Changed back to echo to win a few bytes as I only used printf to force-format as int. By incrementing the incremented $i with 0 I get a valid integer. By using single quotes as string delimiter the backslash does not need to be escaped, resulting in another byte freed
80:
Moving the increment of $i from the last for-section to the prinf gave me another 3 off. (See comments below)
for(;$i<101;usleep(rand(1,75e4)))printf("\rloading %s %d%%","-\\|/"[$i%4],$i++);

83:
Removed init of a variable with the loaderstates.
for(;$i<101;usleep(rand(1,75e4)),$i++)printf("\rloading %s %d%%","-\\|/"[$i%4],$i);

90:
I tried removing the init of $i to gain some bytes, as I had to add quite a few to enable the loader animation. printf adds 2 as opposed to echo, but formatting NULL as an integer results in 0.
for($l='-\|/';$i<101;usleep(rand(0,750)*1e3),$i++)printf("\rloading %s %d%%",$l[$i%4],$i);

There's one mistake: The question requires the delay to be between 1 and 750, inclusive. You have between 0 and 750. Also, you could move the increment to the printf, saving you a single byte: for(;$i<101;usleep(rand(1,750)*1e3))printf("\rloading %s %d%%",'-\|/'[$i%4],$i++); (82 bytes)

@IsmaelMiguel rand() is inclusive, or is this because of the multiplication by *1e3?  I'm going to sneak in that free byte.

The question requires a random interval between 1ms and 750ms (inclusive). rand(0,750)*1e3 returns a value between 0 (invalid) and 750, which is multiplied by 1000. rand(1,75e4) returns a value between 1 (invalid) and 750000. The delay must be rand(1,750)*1e3, since you use usleep(). It works with microseconds, which is 1000x smaller than a millisecond.

This may take you inconveniently close to user59178´s answer, but echo is 3 bytes shorter than printf. You may want to put the most recent version to the top and use #title instead of **title**. And there is a space missing between the number and the %.

@Titus I can't use echo here because I didn't initialize my $i, null to string evaluates to '', via printf I force integer (%d) resulting in null = 0. #justphpthings

So you would start with 0 % ... or not? But nm; this adds a little diversity to the answers.

With a regular error it would start with %, not even a number in front of it. I thought I would be able to make it shorter than the current shortest PHP answer because I didn't have to init ($i=-1 is 5 chars, whilst printf is only 2 longer than echo) but I guess the needed placeholders made it longer again. This does give me an idea to possibly golf it even further

If you run with -r, you have to use double quotes and you need the final ; (+1 byte). If not, you have to surround the code with PHP tags (+4 bytes). Nice one none the less.

Groovy, 113 87 bytes
-36 bytes thanks to lealand
{p=-1;101.times{print"\rLoading ${"-\\|/"[p++%4]} $p%";sleep Math.random()*750as int}}

84 bytes, and should run from Groovy console: p=-1;101.times{println"Loading ${"-\\|/"[p++%4]} $p%";sleep Math.random()*750as int}

Although the question owner not explicitly requested, he probably wants the consecutive loading messages to overwrite each other. There is no size difference, so better change println"Loading… → print"\rLoading…. And remove that variable p, use the implicit it instead.

C#, 170 149 135 Bytes
()=>{for(int i=0;i++<=100;System.Threading.Thread.Sleep(new Random().Next(1,750)))Console.Write($"\rloading {@"-\|/"[i % 4]} {i} %");};

Ungolfed:
static void l()
{
    for (int i = 0; i <= 100; System.Threading.Thread.Sleep(new Random().Next(1, 750)))
        Console.Write($"\rloading {@"-\|/"[i % 4]} {i} %");
}

I won't guarantee that every character in this is right, please correct me if there are compilation errors. I had to type the whole thing on my phone so I might have accidentally included some errors...  ¯_(ツ)_/¯
I hope you guys forgive me that
Tested it on my PC, works like a charm and I even saved a whole 20 bytes thanks to pmbanka :)

You can use \r (carriage return) instead of Console.Clear(). You can also inline s variable to save some bytes.

You can also save an extra byte by replacing the i<=100 for i<101

for (int i = 0; i <= 100; i++) can be rewritten as for (int i =  0; i++ <= 100;) Then you can put the Thread.Sleep within the place where i++ was and save both curly brackets. Cutting 3 bytes in total

Also OP didnt ask for a Programm so you can replace static void l() with ()=>

Bash, 162 104 bytes
Modification of Zachary's answer on a related question, with massive improvements by manatwork:
s='-\|/'
for x in {0..100};{
printf "\rloading ${s:x%4:1} $x %%"
sleep `printf .%03d $[RANDOM%750+1]`
}

I had to look up how to do random numbers in bash.
Ungolfed / Explained
s='-\|/'
for x in {0..100}
{
    # \r returns the carriage to the beginning of the current line.
    # ${s:x%4:1} grabs a substring from s, at index x%4, with a length of 1.
    printf "\rloading ${s:x%4:1} $x %%"

    # "$RANDOM is an internal bash function that returns
    #   a pseudorandom integer in the range 0 - 32767."
    # .%03d is a dot followed by a base-ten number formatted to 3 places,
    #   padded with zeros if needed.
    # sleep accepts a floating point number to represent milliseconds.
    sleep `printf .%03d $[RANDOM%750+1]`
}

Nice first try. See Tips for golfing in Bash for improvement tips. Personally would go with s='-\|/';for x in {0..100};{ printf "\rloading ${s:x%4:1} $x %%";sleep \printf .%03d $[RANDOM%750+1]`; }` BTW, our fellow site [unix.se] also has a question about How to do integer & float calculations, in bash or other languages/frameworks?.

@manatwork Good links!  I didn't know about $[math], using { } instead of do done, or using back ticks instead of $().  Yeah, reusing $x for accessing the loader graphic array makes sense.  Also, slapping a . in front of the number to get the decimal for sleep is pretty sweet!

C 112 103 bytes
Saved 9 bytes thanks to @G. Sliepen.  Not very exciting, just a golf of your C++ answer basically.  Also not a very exciting random function.  I thought about Sleep(c[i%4]), or Sleep(i) but they're not random at all!
#import<windows.h>
i;f(){for(;i<101;printf("\rloading %c %d %%","-\\|/"[i%4],i++),Sleep(rand()%750+1));}

Ungolfed:
#include <windows.h>
int i;
void f() {
  for(;i<101;) {
    printf("\rloading %c %d %%", "-\\|/"[i%4], i++);
    Sleep(rand()%750+1);
  }
}

I am afraid but rand ()%750 generates numbers from 0-749 you will need to add 1.

Changing rand()%750 to rand()%751 won't give the result you want. It will generate a random value between 0 and 750. In the question, the delay must be between 1 and 750 (inclusive). According to https://www.tutorialspoint.com/c_standard_library/c_function_rand.htm, the rand() function generates numbers between 0 and (at least) 32767. If you do 0 % 750, you get 0 since 0 / <anything> == 0.

Shave off 9 bytes by removing char*c="-\\|/"; and using the literal string directly instead of the variable c: printf(...,"-\\|/"[i%4],...)

PHP, 66 79 bytes
for($i=-1;++$i<101;usleep(rand(1,75e4)))echo"\rloading ","-\\|/"[$i%4]," $i %";

Unfortunately I had to assign $i in order to get it to print '0'.
Use like:
php -r 'for($i=-1;++$i<101;usleep(rand(1,75e4)))echo"\rloading ","-\\|/"[$i%4]," $i %";'

Edits: thanks to Titus confirming exactly what's allowed with Mukul Kumar we can save 3 bytes with a less restricted range, but not all 9 bytes with an unrestricted range. Thanks also for pointing out that I forgot the cycling character and providing a simple solution to do it.

The random requirements are that you generate all 1ms to 750ms with a possibility>0. I can´t  see that other values are prohibited. rand(1,75e4) saves 3 bytes; 1e6 can save another one; and no parameters at all save 9 bytes altogether; and I don´t see that violate any rule. But you forgot to cycle the character: +16 for ","-\\|/"[$i%4]," instead of -.

@Titus Won't usleep(rand(1,75e4)) generate a random interval between 1 microsecond and 750 milliseconds? Also, according to the question, the interval must be between 1 and 750, inclusive.

See the latest comments on the question: 1 to 75e4 is acceptable.

@Titus I'd considered changes like those but decided to go with what seemed implied by the question (integer millisecond delays). Thanks for asking exactly what was allowed!

Mathematica, 133 Bytes
Dynamic[If[x<100,x++,,x=0];Row@{"Loading ",StringPart["-\|/",1+x~Mod~4]," ",x,"%"},
    UpdateInterval:>RandomReal@.75,TrackedSymbols:>{}]

This will run once, assuming x is undefined.  Clear@x will restart it.
55 characters tied up in verbosity :/

Is that a fixed interval or will it be repeatedly randomized?

It's randomized.  UpdateInterval:>.75 would have been fixed

@Titus: I believe UpdateInterval:>RandomReal@.75 repeatedly calls RandomReal, but UpdateInterval->RandomReal@.75 would call it only once.

R - 94 bytes
for(i in 0:100){cat('\rLoading',c('-','\\','|','/')[i%%4+1],i,'%');Sys.sleep(sample(750,1)/1e3)}

Really nice that sample(750,1) == sample(1:750,1).

HTML + JS (ES6), 16 + 87 = 103 bytes

(f=_=>a.innerHTML='\\|/-'[i++%4]+` ${i<100&&setTimeout(f,Math.random()*750),i} %`)(i=0)
loading <a id=a>

Noodel, noncompeting 40 bytes
Just going back through old challenges (as in challenges that were made before Noodel) and competing with Noodel to find where it is weak.
Loading¤”ḋḟƇḣ⁺s¤ṡ⁺Ḷ101ạ¤%ɱṠĖ²⁺Çṛ749⁺1ḍ€Ḃ

If final output does not matter, then can save 2 bytes.
Loading¤”ḋḟƇḣ⁺s¤ṡ⁺Ḷ101ạ¤%ɱṠĖ²⁺Çṛ749⁺1ḍ

Noodel pushes the top of the stack to the screen at the end of the program so by adding the €Ḃ it prevents that from happening.
Try it:)
How It Works
Loading¤”ḋḟƇḣ⁺s¤ṡ⁺Ḷ101ạ¤%ɱṠĖ²⁺Çṛ749⁺1ḍ€Ḃ # Main Noodel script.

Loading¤”ḋḟƇḣ⁺s¤ṡ⁺                       # Creates the array ["Loading¤-¤", "Loading¤\¤", "Loading¤|¤", "Loading¤/¤"]
Loading¤                                 # Pushes the string "Loading¤"
        ”Ƈḟḋḣ                            # Pushes the array ["-", "\", "|", "/"]
             ⁺s                          # Concats "Loading¤" to each element in the array by prepending.
               ¤                         # Pushes a "¤" onto the stack.
                ṡ                        # Pushes
                 ⁺

                  Ḷ101ạ¤%ɱṠĖ²⁺Çṛ749⁺1ḍ   # Main loop that creates the animation.
                  Ḷ101                   # Loop the following code 101 times.
                      ạ                  # Pushes on a copy of the next animation element from the array.
                       ¤%                # Pushes the string "¤%"
                         ɱ               # Pushes on the current count of the number of times that have looped (zero based).
                          Ṡ              # Swaps the two items at the bottom of the stack.
                           Ė             # Pushes the item at the bottom of the stack to the top (which will be the string selected from the array).
                            ²⁺           # Concat twice appending the loop count then the string "¤%" to the string selected from the array.
                              Ç          # Pops the string off of the stack, clears the screen, then prints the string.
                               ṛ749      # Randomly generate an integer from 0 to 749.
                                   ⁺1    # Increment the random number producing a random number from 1 - 750.
                                     ḍ   # Pop off the stack and delay for that number of milliseconds.

                                      €Ḃ # Ends the loop and prevents anything else being displayed.
                                      €  # Ends the loop (new line could be used as well)
                                       Ḃ # Destroys the current stack therein, nothing gets pushed to the screen at the end of the program.

<div id="noodel" code="Loading¤”ḋḟƇḣ⁺s¤ṡ⁺Ḷ101ạ¤%ɱṠĖ²⁺Çṛ749⁺1ḍ€Ḃ" input="" cols="14" rows="2"></div>

<script src="https://tkellehe.github.io/noodel/noodel-latest.js"></script>
<script src="https://tkellehe.github.io/noodel/ppcg.min.js"></script>

Why are there so many ¤s?

@KritixiLithos Noodel uses spaces as a NOP so for printing a space the ¤ is used:)

Btw, it's nice that there is a stack snippet for this :)

How does the snippet work? Does the imported script find the element with the id of noodle, then translate the code to Javascript?

@Carcigenicate, Yes. The "parser" is the JavaScript function noodel which handles the code properly. It translates the code into tokens that are JavaScript objects that get chained together then executed. The ppcg.min.js creates the proper HTML objects and translates the output of what is parsed into the HTML objects to create the display. Every token is executed by stepping through them triggering a step event which is registered to update the screen:) Does that help?

C 126 121 bytes
f(){i=0;char c[]="/-\\|";for(;i<101;i++){printf("\rloading %c %d %% ",c[i%4],i);fflush(stdout);usleep(1000*(rand()%75));}

Ungolfed version:
 void f()
 {
  int i=0;
  char c[]="/-\\|";
  for(;i<101;i++)
  {
    printf("\rloading %c %d %% ",c[i%4], i);
    fflush(stdout);
    usleep(1000*(rand()%75));
  }
 }

@Carcigenicate @ Mukul Kumar Did not read between the lines there, Thanks! :)

c[] is not random... But is cycling....

Or, in other words, you're not supposed to pick a random character from "|/-", you're supposed to display /, then -, then , then |, in a cycle.

@MukulKumar @ Carcigenicate  Updated the code so that it does what the spec says regarding cycling characters!

Octave, 122 120 119 108 bytes
I misread the challenge and created an infinite loader that restarted at 0 once it passed 100. Making it into a one time only loader:
a='\|/-';for i=0:100;clc;disp(['Loading ',a(1),' ',num2str(i),' %']);a=a([2:4,1]);pause(0.749*rand+.001);end

Circulating a, a=a([2:4,1]) was flawr's idea here. Also, saved 2 bytes by skipping the parentheses after rand thanks to MattWH.

Should it be .749*rand()+.001? This can wait for 751ms. Also you can leave the () off rand and save 2 bytes.

MATLAB, 108 bytes
function k;for i=0:100;a='-\|/';pause(rand*.749+.001);clc;['loading ' a(mod(i,3)+1) ' ' num2str(i) ' %']
end

Racket 110 bytes
(for((i 101))(printf"Loading ~a ~a % ~n"(list-ref'("-" "\\" "|" "/")(modulo i 4))i)(sleep(/(random 750)1000)))

Ungolfed:
(define(f)
  (for ((i 101))
    (printf "Loading ~a ~a % ~n" (list-ref '("-" "\\" "|" "/") (modulo i 4)) i)
    (sleep (/(random 750)1000))))

Testing:
(f)

Output:

(This gif file is showing slower display than actual)

What's with the stuff at the end in the gif?

This seem to be an artefact from screen capture program.

ForceLang, 250 bytes
Noncompeting, requires language features which postdate the question
def D def
D w io.write
D l e+"loading"+s
D z string.char 8
D s string.char 32
D d datetime.wait 750.mult random.rand()
D e z.repeat 24
D n set i 1+i
D k s+n+s+"%"
set i -1
label 1
w l+"-"+k
if i=100
exit()
d
w l+"\"+k
d
w l+"|"+k
d
w l+"/"+k
d
goto 1

I should probably fix some bugs related to string literal parsing soon.

107 75 Ruby
-32 thanks to manatwork

Normal
i=0
(0..100).each{|c|
system'clear'
puts"loading #{'\|/-'[i=-~i%4]} #{c} %"
sleep rand*(0.750-0.01)+0.01
}

Golfed
101.times{|c|$><<"\rloading #{'-\|/'[c%4]} #{c} %";sleep rand*0.749+0.001}

Given you have a single line of output to overwrite, the system'clear' is overkill here. Also the use of the separate variable i. Oh, and precalculate where possible: 0.750-0.01 → 0.749 (also note that you lack one decimal place in 0.01 – should be 0.001). The resulting 101.times{|c|$><<"\rloading #{'-\|/'[c%4]} #{c} %";sleep rand*0.749+0.001} becomes very similar to Conor O'Brien's Ruby answer in Loading… Forever but so is the challenge.

Python 3, 149 bytes
import time,random;f=0;n=0
while n<=100:
 print("Loading...","|/-\\"[f],n,"%",end="\r");f+=1
 if f>=3:f=0
 n+=1
 time.sleep(random.uniform(.25,.75))

Similar to Loading... Forever, but I did have to edit my answer from there a lot.

tcl, 116
set i 0;time {lmap c {- \\ | /} {puts -nonewline stderr "\rloading $c $i%";after [expr int(187*rand())]};incr i} 100

Playable in http://www.tutorialspoint.com/execute_tcl_online.php?PID=0Bw_CjBb95KQMOXoybnVSOVJEU00

Your output seems little off...

hmm,,, my code disappeared! ...

I mean that your output is in this format "loading... xx%" instead it should be like this "loading - xx%" where '-' varies as explained in the question.

@MukulKumar: Fixed.

TI-Basic, 80 bytes
For(I,0,100
For(A,0,randE2
End
Text(0,0,"loading "+sub("-\|/",1+fPart(I/4),1)+" ",I," %
End

The randomness comes from the For( loop (E is scientific E token) and since TI-Basic is interpreted there is also automatically some overhead. Remember that in TI-Basic, lowercase letters and some less common ASCII symbols are two bytes each (so specifically for this program, l o a d i n g sub( \ | % are the two-byte tokens

Clojure, 109 bytes
(doseq[[c i](map vector(cycle"\\|/-")(range 101))](print"\rloading"c i\%)(flush)(Thread/sleep(rand-int 751)))

Loops over a list of the range of numbers from 0 to 100, zipped with an infinite list of "\|/-" repeating forever.
; (map vector...) is how you zip in Clojure
;  All arguments after the first to map are lists. The function is expected to
;  take as many arguments as there are lists. vector is var-arg.
(doseq [[c i] (map vector (cycle "\\|/-") (range 101))]
  ; \r to erase the old line
  (println "\rloading" c i \%)
  (Thread/sleep (rand-int 751)))

Visual Basic, 371 Bytes
module m
sub main()
Dim s as Object
for i as Integer=0 to 100
Select Case new System.Random().next(0,9)
Case 0
s=1
Case 1
s=2
Case 2
s=5
Case 3
s=10
Case 4
s=15
Case 5
s=20
Case 6
s=25
Case 7
s=50
Case 8
s=500
End Select
Console.SetCursorPosition(0,0)
console.write("loading "+"-\|/"(i mod 4)+" "+i.tostring+" %")
system.threading.thread.sleep(s)
next
end sub
end module

Expanded:
module m
    sub main()
        Dim s as Object
        for i as Integer=0 to 100
            Select Case new System.Random().next(0,9)
                Case 0
                s=1
                Case 1
                s=2
                Case 2
                s=5
                Case 3
                s=10
                Case 4
                s=15
                Case 5
                s=20
                Case 6
                s=25
                Case 7
                s=50
                Case 8
                s=500
            End Select
            Console.SetCursorPosition(0,0)
            console.write("loading " + "-\|/"(i mod 4) + " " + i.tostring + " %")
            system.threading.thread.sleep(s)
        next
    end sub
end module

Java 8, 130 bytes
()->{for(int n=0;n<101;Thread.sleep((long)(1+Math.random()*750)))System.out.print("\rloading "+"-\\|/".charAt(n%4)+" "+n+++" %");}

Explanation:
()->{                           // Method without parameter nor return-type
  for(int n=0;n<101;            //  Loop from 0 to 100
      Thread.sleep((long)(1+Math.random()*750)))
                                //   And sleep randomly 1-750 ms
    System.out.print(           //   Print:
      "\r                       //    Reset to the start of the line
      loading "                 //    Literal "loading "
      +"-\\|/".charAt(n%4)+" "  //    + the spinner char & a space
      +n++                      //    + the number (and increase it by 1)
      +" %");                   //    + a space & '%'
                                //  End of loop (implicit / single-line body)
}                               // End of method

Output gif:

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Rank a list of integers
You're given a non-empty list of positive integers, e.g.
[6 2 9 7 2 6 5 3 3 4]

You should rank these numbers by their value, but as is usual in leaderboards, if there is a tie then all the tied numbers get the same rank, and an appropriate number of ranks is skipped. The expected output for the above list would therefore be
[3 9 1 2 9 3 5 7 7 6]

For example, the highest value in the input was 9, so this becomes a 1 (first rank). The third highest value is 6, so both 6s become 3, and the rank 4 is skipped entirely.
Rules
You can use any convenient, unambiguous, flat list format for input and output. The first/smallest rank in the output should always be 1.
You may write a program or a function and use any of the our standard methods of receiving input and providing output.
You may use any programming language, but note that these loopholes are forbidden by default.
This is code-golf, so the shortest valid answer – measured in bytes – wins.
Test Cases
[8] -> [1]
[1 15] -> [2 1]
[18 14 11] -> [1 2 3]
[11 16 14 8] -> [3 1 2 4]
[15 15 15 15 15] -> [1 1 1 1 1]
[10 2 5 4 15 5] -> [2 6 3 5 1 3]
[5 5 10 10 5 11 18] -> [5 5 3 3 5 2 1]
[2 4 9 4 17 9 17 16] -> [8 6 4 6 1 4 1 3]
[11 17 19 17 10 10 15 3 18] -> [6 3 1 3 7 7 5 9 2]
[2 11 4 8 3 3 12 20 4 18] -> [10 4 6 5 8 8 3 1 6 2]
[12 6 10 2 19 19 6 19 8 6 18] -> [5 8 6 11 1 1 8 1 7 8 4]
[5 6 14 19 13 5 19 9 19 9 9 19] -> [11 10 5 1 6 11 1 7 1 7 7 1]
[9 2 12 3 7 11 15 11 6 8 11 17 11] -> [8 13 3 12 10 4 2 4 11 9 4 1 4]
[3 5 15 7 18 5 3 9 11 2 18 1 10 19] -> [11 9 4 8 2 9 11 7 5 13 2 14 6 1]
[6 11 4 19 14 7 13 16 10 12 7 9 7 10 10] -> [14 6 15 1 3 11 4 2 7 5 11 10 11 7 7]
[11 20 11 1 20 16 11 11 4 8 9 7 11 14 10 14] -> [6 1 6 16 1 3 6 6 15 13 12 14 6 4 11 4]
[4 7 15 2 3 2 3 1 14 2 10 4 7 6 11 2 18] -> [9 6 2 13 11 13 11 17 3 13 5 9 6 8 4 13 1]
[5 1 17 7 1 9 3 6 9 7 6 3 2 18 14 4 18 16] -> [12 17 3 8 17 6 14 10 6 8 10 14 16 1 5 13 1 4]
[5 6 8 10 18 13 20 10 7 1 8 19 20 10 10 18 7 2 1] -> [16 15 11 7 4 6 1 7 13 18 11 3 1 7 7 4 13 17 18]
[12 17 8 2 9 7 15 6 19 5 13 16 14 20 10 11 18 4 3 1] -> [9 4 13 19 12 14 6 15 2 16 8 5 7 1 11 10 3 17 18 20]

Closely related. The difference is that that challenge guarantees that the input is sorted, which means that most answers rely on a form of indexOf function. I believe for unsorted input there are shorter alternatives in many languages.

Also related

Im sorry, but I believe that this is too close to Lynn's link. The differences are minimal: The values are truncated, you can't assume an already-sorted input and half of the output has its order swapped. The accepted answer on the linked question nearly works. With minimal effort, someone could make it work. As such, I stand that this is a duplicated.

I disagree, this is clearly not a duplicate.

I agree with timtech, this challenge is simpler, but not a duplicate.

Workaround in Excel for silly Rules Regarding Mouse Inputs on Code Golf Stack Exchange: (WESRRMICGSE) 28 bytes
rank(RC[1],r1c1:r1024:c1024)
Input list as csv (10,23,34,2,) into the compiler after entering the source. no quotes, no brackets, trailing comma.
WESRRMICGSE is exactly like programming in excel, except you can omit the initial '=' sign to save a byte. The difference in functionality comes from the fact that WESRRMICGSE will either drag the formula down to copy the code automatically and provide different outputs provided with a single integer input. provided a list as input, that list goes into the B column (input column), and the formula is drug down automatically to match the number of inputs. (eg: the input 34,21,45, would 'drag' the formula down 2 cells, for a total of 3 cells with the formula).
Edit: I never expected this answer to be popular. Wow!

The language name is a bit obnoxious...

What rules do you refer and how exactly are they silly?

@LuisMendo the rules declared here: http://meta.codegolf.stackexchange.com/questions/10199/what-mouse-interactions-are-allowed-by-default-as-part-of-input-output I think the rule is silly because I took 5 minutes to write an 'interpreter' that circumvents  exactly what they are talking about. The more that this language can be used in challenges, the sillier the rule becomes. I'll be sure to include this in the link.

MATL, 4 bytes
&<sQ

Try it online! Or verify all test cases.
Explanation
&<   % Input array implicitly. Matrix of all pairwise "less than" comparisons
s    % Sum of each column
Q    % Add 1. Display implicitly

Python 2, 41 bytes
lambda l:map(sorted(l+[l])[::-1].index,l)

For each value, find its index in the list sorted by decreasing order. To make the largest value give 1 instead of 0, we use an extra "infinity" element of the list itself, since Python 2 treats lists as bigger than numbers.
A more direct solution is 42 bytes and also works in Python 3.
lambda l:[1+sum(y<x for x in l)for y in l]

For each element, counts the number of smaller elements, adding 1 to shift to 1-indexed.

Jelly, 5 bytes
ṢṚiÐ€

Try it online!
How it works
ṢṚiÐ€  Main link. Argument: A (array)

ṢṚ     Sort and reverse A.
  iÐ€  Find the index of each n in A in the previous result.

R, 24 25 20 bytes
Uses the standard rank function with the "min" ties method over the negated vector.  cat added to output it to STDOUT.  Saved one thanks to @Guiseppe
cat(rank(-scan(),,"mi"))

Example
> cat(rank(-scan(),,"mi"))
1: 9 2 12 3 7 11 15 11 6 8 11 17 11
14:
Read 13 items
8 13 3 12 10 4 2 4 11 9 4 1 4
>

I think you need to wrap it in cat for it to be a full program.

@AlexA. I was wondering about that.  Would it be fair to say that this is a function in it's own right and in that case would rank(-a,,'min') be ok where a is the list input in vector form?

In that case we would consider it a snippet, because it assumes that a variable already exists in the namespace. To make it a proper function submission you'd need function(a)rank(-a,,'min').

can be shortened to just "mi" rather than "min".

@AlexA. why does it need to be wrapped in cat?  If the submission had been function(a)rank(-a,,'mi') that would be considered sufficient and the program output is identical to rank(-scan(),,'mi')

PowerShell v2+, 43 41 bytes
($a=$args)|%{@($a|sort -d).indexof($_)+1}

Developed independently, but I see that this is the same algorithm as @xnor's Python solution, so /shrug.
Takes input as individual command-line arguments (i.e., a space separated list). Output (default formatting) is a newline between elements.
For each element in the input list, it sorts the input list in -descending order, takes the .indexOf() the current element, and adds 1. Note the explicit array cast @(...) in order to account for a single-digit input. The resulting numbers are left on the pipeline and output is implicit.
Saved 2 bytes thanks to @Matt!
Example
PS C:\Tools\Scripts\golfing> .\rank-the-integers.ps1 6 2 9 7 2 6 5 3 3 4
3
9
1
2
9
3
5
7
7
6

Is there a reason sort -d didn't work for you? That is unambiguous for me.

@Matt Odd. On my Win8.1 ISE, it states that -Descending and -Debug are ambiguous. But in the straight shell on Win8.1 and the shell and ISE on Win10 it works fine. This wouldn't be the first time that my particular Win8.1 install is goofy... :-/ Thanks for the golf!

Also did this not work for all test cases? $args|%{@($args|sort -d).indexof($_)+1} it is shorter but I have not had a good look to know if it works

@Matt That doesn't work because the second $args functions as input for the script block of the loop {...}, just like if you were using a filter or function.

Octave, 15 bytes
@(x)sum(x<x')+1

Port of my MATL answer to Octave. It also works in Matlab R2016b.
The code defines an anonymous function. To call it, assign it to a variable. Try it at Ideone.

JavaScript (ES6), 38 36 bytes
a=>a.map(e=>a.map(d=>r+=e<d,r=1)&&r)

Edit: Saved 2 bytes thanks to @ETHproductions.

.map FTW ;-) a=>a.map(e=>a.map(d=>r+=e<d,r=1)&&r)

@ETHproductions Why do you always have to spoil my fun?

Jelly, 5 bytes
<S‘ð€

TryItOnline!
How?
<S‘ð€ - Main link: listOfValues
   ð  - dyadic chain separation
    € - for each
<     - less than (vectorises) - yields a list of 1s and 0s
 S    - sum - yields number of values the current value is less than (those that beat it)
  ‘   - increment - the place of a value is the number that beat it plus 1.

How similar is this to the J code I was about to submit? 1+(+/@:<)"0 1~

Looks similar (uses a reduce to sum?), but that should by no means stop you posting your code!

I guess I was more wondering what "dyadic chain separation" and "for each" do in a J-inspired language.

Ah, well from your explanation I think your code is more like >€µS‘, or really like <@€µS‘ (@ reverses arguments to the < operator). The J ~ is implicit in the chain to the left of the µ, which is monadic (rather than dyadic) separation and < vectorises if the argument(s) is(are) list(s).

Perl 6,  42  26 bytes
Find the first index :k in a reversed [R,] sorted list
{map {[R,](.sort).first(*==$^a,:k)+1},@$_}

Count the values that are larger, and add one
{map {1+.grep(*>$^a)},@$_}

JavaScript, 87 49 bytes
f=a=>a.slice().map(function(v){return a.sort(function(a,b){return b-a}).indexOf(v)+1 })
a=>[...a].map(v=>a.sort((a,b)=>b-a).indexOf(v)+1)
Thanks Conor O'Brien and ETHproductions!

You can use an anonymous function in the map, i.e. v=>a.sort((a,b)=>b-a).indexOf(v)+1.

You don't need .slice() at all, because .map operates on a copy of the array.

And our site policy is that the function does not need to be named, so you can remove the leading f=, too.

@ETHproductions If I remove slice, passing in [18,13,18] returns [1,1,2] instead of [1, 3, 1]

Oh, that's weird... I guess it's because a.sort() stores the sorted array in a. But you can change a.slice() to [...a] to save a few bytes.

Thanks again @ETHproductions. On an unrelated note, if I have a function f=(n,t)=>s=n.split('.'), can I call s[1] inside of that function? n would look like '1.2.3'

@ETHproductions My idea is to do something like f=(n,t)=>s=n.split('.');s[t]++

Yes, you can do that, but you'll need to wrap multiple statements in parentheses or braces: f=(n,t)=>{s=n.split('.');s[t]++} or f=(n,t)=>(s=n.split('.'),s[t]++)

J, 14 8 bytes
1+1#.</~

How?
1+1#.</~ - Consumes and returns a list of integers
       ~ - Use the same list for both inputs
     </  - Create a table of less-than comparisons
  1#.    - Treat each row like digits of a base-one number, returning a list of integers
1+       - Increment the results

Previous solution
1+(+/@:<)"0 1~

Hello, I've found a shorter version for 8 bytes 1+1#.</~. Row-wise summation is performed using base 1 conversion. Another alternative is 1+\:~i.] which is also 8 bytes.

Nice! Do you want to post your own answer? I'll otherwise include the base-one improvement.

Nah, I'm fine with just suggesting byte-savings. Feel free to use them

Mathematica, 44 bytes 42 bytes 40 bytes
xPosition[SortBy[x,-#&],#][[1,1]]&/@x

 is the 3 byte private use character U+F4A1 (Wolfram docs page)
Edit: Thanks to JHM for the byte savings.

Fails for test case {10,2,5,4,15,5} (the output should be {2,6,3,5,1,3} not {2,5,3,4,1,3}. Note that 4 has to be skipped because there are two 5s in the input).

Duly corrected.

-2 bytes by switching x and # (effectively getting rid of the parentheses): xPosition[SortBy[x,-#&],#][[1,1]]&/@x.

Pyke, 6 bytes
FQS_@h

Try it here!
F      - for i in input():
 QS    -     sorted(input())
   _   -    reversed(^)
    @  -   i.find(^)
     h -  ^+1 (not required if allowed to start from 0)

Haskell, 28 bytes
f l=[1+sum[1|y<-l,y>x]|x<-l]

Just some list comprehensions.

20sec too late. I was about to post the very same answer.

@nimi You can post it too!

Wonder, 28 bytes
@(->@+1:0iO#0rev sort#I#1)#0

Usage:
(@(->@+1:0iO#0rev sort#I#1)#0)[6 2 9 7 2 6 5 3 3 4]

Map over input array with a function that adds 1 to the first index of the item in a descending-sorted version of the input.

Dyalog APL, 7 bytes
⊢⍳⍨⍒⊃¨⊂

⊢ arguments'
⍳⍨ indices in
⍒ the indices which would sort the argument descending
⊃¨ each picked from
⊂ the entire argument
TryAPL online!

Jellyfish, 15 bytes
p`&& ~i
  >/+`<

Try it online!
Explanation
There doesn't seem to be a good way to find the index of a value in a list in Jellyfish yet, so this uses the approach of counting how many values are bigger than current one and incrementing the result. This is largely done by constructing a unary function which computes this value for a given element.
     `<

This creates a threaded version of the comparison operator, so if you give this an integer and a list, it will return a list of comparison results between that integer and each element in the list.
     ~i
     `<

This curries the right-hand argument of the previous function with the input list. So the result is a unary function which takes an integer and gives you the list of comparison results with the input of the program.
   & ~i
   /+`<

Here, /+ is reduction by addition, which means it's simply a "sum this list" function. & composes this onto the previous function, so we now have a unary function which counts how many values in the input are bigger than that integer.
  && ~i
  >/+`<

We also compose the increment function onto this.
 `&& ~i
  >/+`<

Finally, we thread this function as well, so that it's automatically applied to each integer of a list passed to it. Due to the layout of the code, i happens to be taken as the input of this function as well, so that this computes the desired output.
p`&& ~i
  >/+`<

Finally, this prints the result.

Mathematica, 37 bytes
Min@Position[-Sort@-#,i]~Table~{i,#}&

A pure function which will rank it's input, as per the rules of the problem. Ex:
Min@Position[-Sort@-#, i]~Table~{i, #} &[{6, 2, 9, 7, 2, 6, 5, 3, 3, 4}]
(*{3, 9, 1, 2, 9, 3, 5, 7, 7, 6}*)

brainfuck, 124 bytes
->,[>>>+>,]<[-<+]+[-->[<[<<<<]>>>+>[>[>>]<[[<<+<<]>+>[->>>>]]<+>>>]+[-<<+]->]<[<
<<<]>+.,>>[>[>->+>>]<<[-<<<<]>-]+[->+]+>>>>]

Formatted:
->
,[>>>+>,]
<[-<+]
+
[
  -->
  [
    <[<<<<]
    >>>+>
    [
      >[>>]
      <
      [
        [<<+<<]
        >+>[->>>>]
      ]
      <+> >>
    ]
    +[-<<+]
    ->
  ]
  <[<<<<]
  >+.,>>
  [
    >[>->+>>]
    <<[-<<<<]
    >-
  ]
  +[->+]
  +>>>>
]

This is designed for 8-bit brainfuck implementations. Input and output are via byte values.
Try it online.
For each element, this counts the number of elements greater than it, then prints the result plus one. This is accomplished by incrementing all elements until the current element equals zero, updating the result whenever another element becomes zero before the current element.
The tape is broken into 4-cell nodes,
b c 0 0
where c is the element and b is a navigation flag that is negative one for the current element, otherwise one.
The result and a copy of the current element are kept to the left of the array.

Java, 215 bytes
public class G{public static void L(int[]A){int[]r=new int[A.length];for(int i=0;i<A.length;i++){int c=1;for(int j=0;j<A.length;j++){if(A[j]>A[i])c++;}r[i]=c;}for(int i=0;i<r.length;i++)System.out.print(r[i]+",");}}

Explanation:
Very self explanatory.
Basically for each integer in the array it checks how many are larger than it, then prints the new array with the rankings.
I'm sorry this isn't very concise but it's my first try at one of these and I didn't see an entry for java. I'm sure it can be golfed down more.
It can be run just by making reference to the static method and passing an array. I didn't think it was necessary to write the main function but if it is I'll do that in the future.

Can you remove some of this whitespace? As it is this isn't golfed really at all.  (i.e. the spaces in r = new)

@EasterlyIrk Yes, sorry i'm not used to doing this. I think I got rid of all unnecesary whitespace.

Can you name the "rankNumbersGolf" something shorter like "G" or something?

@EasterlyIrk Yes, thanks.

I don't java well, but can you remove some spaces in the three for (?

@EasterlyIrk Wow, yes I can. So used to coding for clarity that I never think to do things like that.

Husk, 5 bytes
m€↔O¹

Try it online!
Explanation
m€↔O¹
   O¹ sort the input in ascending order
  ↔   reverse it
m   ¹ map the input to:
 €    it's index in that list

Ruby, 45 40 bytes
->a{a.map{|x|a.sort.reverse.index(x)+1}}

How is this called? I cannot get it to match the test cases, there seems to be a bug with equal ranks. For example [10, 2, 5, 4, 15, 5] gives me output [2, 5, 3, 4, 1, 3] when it should be [2, 6, 3, 5, 1, 3] - I think to fix that you just remove the .uniq - saving 5 bytes!

I seem to have misread the question. Thanks for spotting that!

PHP, 101 bytes
There must be some shorter way.
function f(&$a){for($r=1;$v++<max($a);$r+=$n,$n=0)foreach($a as$k=>$w)if($w===$v){$a[$k]="$r";$n++;}}

function takes input as array of integers, overwrites input variable with ranks as numeric strings.
Usage: $a=[1,2,4,2,2,3];f($a);print_r($a);

Clojure, 48 44 bytes
Update: using for instead of map
#(for[i %](+(count(filter(partial < i)%))1))

Simply filters each value smaller than the current one, counts the length of the list and increments by one.

PHP, 84 bytes
function r($l){$s=$l;rsort($s);foreach($l as$n)$r[]=array_search($n,$s)+1;return$r;}

Usage: Pass the function r your array of integers and it will return the corresponding array of ranked integers.
Passing tests here.

Perl 5, 23 +2 (-ap)
s/\d+/1+grep$&<$_,@F/ge

Try it online

K (oK), 11 bytes
Solution:
1+(x@>x)?x:

Try it online!
Examples:
1+(x@>x)?x:6 2 9 7 2 6 5 3 3 4
3 9 1 2 9 3 5 7 7 6
1+(x@>x)?x:5 6 14 19 13 5 19 9 19 9 9 19
11 10 5 1 6 11 1 7 1 7 7 1

Explanation:
Lookup position of original list in sorted list, then add one.
1+(x@>x)?x: / the solution
         x: / save input as x
  (  >x)    / return indices of x sorted in descending order
   x@       / apply these indices to x (thus sort x)
        ?   / lookup right in left
1+          / add one

Tcl, 54 bytes
proc R L {lmap x $L {lsearch .\ [lsort -r -de $L] $x}}

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/