[Question]
  [
The task is simple. Write an interpreter for the language [\*](https://esolangs.org/wiki/*).
[Here's a bigger link to the wiki.](https://esolangs.org/wiki/*)
There are only three valid \* programs:
* `*` Prints "Hello World"
* `*` Prints a random number between 0 and 2,147,483,647
* `*+*` Runs forever.
The third case must be an infinite loop according to the specifications in [this question](https://codegolf.stackexchange.com/questions/59347/shortest-infinite-loop-producing-no-output)
## Input:
* The input can be taken via any acceptable input method by our standard I/O rules
* It will always be one of the above programs
## Output:
* The first case should print exactly `Hello World`, with or without a trailing line break.
* For the second case, if your language's integer maximum is smaller than 2,147,483,647, use your language's integer maximum
* The first and second cases can print to any acceptable output by our standard I/O rules.
* The third case should not give any output.
## Scoring:
As this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the shortest answer, in bytes, wins.
  
[Answer]
## [\*](https://esolangs.org/wiki/*), 0 bytes
```
```
Since \* has no way of reading input, the default rules allow specifying that [the input must be given by concatenating it onto the program](https://codegolf.meta.stackexchange.com/a/10553/52746).
(... I think. There's an *"at least twice as many upvotes as downvotes"* condition that I don't have the rep to verify).
[Answer]
# [R](https://www.r-project.org/), 69 bytes
```
switch(scan(,""),"*"="Hello, World!"," * "=sample(2^31,1)-1,repeat{})
```
[Try it online!](https://tio.run/##K/r/v7g8syQ5Q6M4OTFPQ0dJSVNHSUvJVskjNScnX0chPL8oJ0VRSUdJQUtBybY4MbcgJ1XDKM7YUMdQU9dQpyi1IDWxpLpW8z9YwX8A "R – Try It Online")
`switch` tries to match the named arguments and if there's no match, selects the first unnamed one after the first, which in this case is the infinite loop `repeat{}`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~21~~ 20 bytes
```
ḊOSØ%HX’¤“½,⁾ẇṭ»¹Ḃ¿?
```
A monadic Link accepting a list of characters.
**[Try it online!](https://tio.run/##ATUAyv9qZWxsef//4biKT1PDmCVIWOKAmcKk4oCcwr0s4oG@4bqH4bmtwrvCueG4gsK/P////yAqIA "Jelly – Try It Online")**
`vL’...` [also works](https://tio.run/##ATUAyv9qZWxsef//dkzigJnDmCVIWOKAmcKk4oCcwr0s4oG@4bqH4bmtwrvCueG4gsK/P////yAqIA "Jelly – Try It Online") (see below).
### How?
```
ḊOSØ%HX’¤“½,⁾ẇṭ»¹Ḃ¿? - Link: list of characters   e.g.: "*"        or  " * "    or  "*+*"
Ḋ                    - dequeue                          ""             "* "         "+*"
 O                   - to ordinals                      []             [42,32]      [43,42]
  S                  - sum                              0              74           85
                   ? - if...
                  ¿  - ...if-condition: while...
                 Ḃ   -    ...while-condition: modulo 2  0              0            1
                ¹    -    ...while-true-do: identity                                85
                     -                                  0              74           (looping)
        ¤            - ...then: nilad followed by link(s) as a nilad:
   Ø%                -    literal 2^32                                 2^32
     H               -    half                                         2^31
      X              -    random integer in [1,n]                      RND[1,2^31]
       ’             -    decrement                                    RND[0,2^31)
         “½,⁾ẇṭ»     - ...else: dictionary words        "Hello World"
```
---
Alternative
```
vL’... - Link: list of characters                 e.g.: "*"        or  " * "    or  "*+*"
 L     - length                                         1              3            3
v      - evaluate (left) as Jelly code with input (right)
       -                                                1^1            3^3          (3^3+3)^3
       -                                                1              27           27000
  ’    - decrement                                      0              26           26999
   ... - continue as above                              "Hello World"  RND[0,2^31)  (looping)
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 66 63 bytes
Thanks to attinat for the -3 bytes.
I only have to check the second character: if the LSB is set, it's a `+` (thus the program is "`*+*`") and the program loops. After that, if it's a `NUL`, the program was "`*`" and we display `Hello World`; otherwise, it displays a random value ("`*`", the only other option left.)
```
f(char*s){for(s++;*s&1;);printf(*s?"%d":"Hello World",rand());}
```
[Try it online!](https://tio.run/##FYyxDsIgFAB3vuKFRMOjbWJXGVz9AwfjQKBgE4TmUXVo@usibHfJ5czgjSnFCfPUJDNuLpHIXadkPo4K1UJzXJ2Q@cIPlp/5dQohwS1RsLwnHa1AVHupEbz0HEUDTd700IYgZZUPwsYAnGh8Hx@oWFWa1jdFOCm2lyJ/xgXtcxm@fw "C (gcc) – Try It Online")
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), `-lp`, `-ir` ~~30~~ ~~26~~ ~~25~~ ~~24~~ ~~20~~ 19 bytes
```
!1=[_“H%c¡“| =[~.|{
```
*-1 byte using flags*
[Try it online!](https://tio.run/##y05N//9f0dA2Ov5RwxwP1eRDC4F0jYJtdJ1eTfX//1r/dXMK/utmFgEA "Keg – Try It Online")
## Answer History
```
?!1=[_“H%c¡“| =[~.|{
```
[Try it online!](https://tio.run/##y05N///fXtHQNjr@UcMcD9XkQwuBdI2CbXSdXk31//9aAA "Keg – Try It Online")
Shortened `Hello World` to dictionary string
```
!1=[_Hello World| =[~.|{
```
[Try it online!](https://tio.run/##y05N//9f0dA2Ot4jNScnXyE8vygnpUbBNrpOr6b6/38FLQUA "Keg – Try It Online")
I never ceased to be amazed at the power of Keg. Credits to user EdgyNerd for another byte saved.
## Prior Versions
```
_!0=[Hello World|\*=[~.|{
```
[Try it online!](https://tio.run/##y05N//8/XtHANtojNScnXyE8vygnpSZGyza6Tq@m@v9/BS0FAA "Keg – Try It Online")
Credit to user A\_\_ for the extra byte saved.
## Old version
```
?!1=[_Hello World| =[__~|{
```
Essentially, takes the input program and:
* Checks to see if the input length is 1, printing "Hello World" if true
* Checks to see if the last character is a space, and prints a random number
* Otherwise runs an infinite loop
Then implicitly print the stack.
```
?                               #Get input from the user
 !1=                            #Compare the stack's length to 1
    [_Hello World           #Push "Hello, World!" to the stack
                     | =        #See if top item is a space
                        [__~|{  #If so, generate a random number, otherwise, infinite loop.
```
4 bytes saved due to the fact that hello world doesnt need punctuation.
[Try it online!](https://tio.run/##y05N//9f0dA2Ot4jNScnP0ZHITy/KCclRrFGASgWX1dT/f@/gpYCAA "Keg – Try It Online") Old version
[Try it online!](https://tio.run/##y05N//9f0dA2Ot4jNScnXyE8vygnpUYByI@vq6n@/x8A "Keg – Try It Online") New version
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 22/25 bytes
The first solution is for the original spec which had `*<space>` as the second programme and the other is for the updated spec which arbitrarily changed it to `<space>*</space>`, with thanks to EoI for the suggested "fix".
Both throw an overflow error upon entering the infinite loop of the third programme but, theoretically, with enough memory (which we may assume for the purposes of [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'")), would run forever.
```
Å?¢?ß:2pHÉ ö:`HÁM Wld
```
[Try programme 1](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=xT%2biP986MnBIySD2OmBIwU0gV45sZA&input=Iioi)  
[Try programme 2](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=xT%2biP986MnBIySD2OmBIwU0gV45sZA&input=IiogIg)  
[Try programme 3](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=xT%2biP986MnBIySD2OmBIwU0gV45sZA&input=IiorKiI)
```
Å?UÎ>S?ß:2pHÉ ö:`HÁM Wld
```
[Try programme 1](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=xT9Vzj5TP986MnBIySD2OmBIwU0gV45sZA&input=Iioi)  
[Try programme 2](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=xT9Vzj5TP986MnBIySD2OmBIwU0gV45sZA&input=IiAqICI)  
[Try programme 3](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=xT9Vzj5TP986MnBIySD2OmBIwU0gV45sZA&input=IiorKiI)
[Answer]
# [Python 2](https://docs.python.org/2/), ~~103~~ ~~93~~ ~~89~~ 87 bytes
I combined my earlier answer with Chas Browns's [answer](https://codegolf.stackexchange.com/a/189620/34718) and got something a few bytes shorter.
The random number will be between 0 and 2\*\*31-1 inclusive.
```
from random import*
i=input()
while'*'<i:1
print["Hello World",randrange(2**31)][i<'!']
```
[**Try it online!**](https://tio.run/##K6gsycjPM/r/P60oP1ehKDEvBUhl5hbkF5VocWXaZuYVlJZoaHKVZ2TmpKprqdtkWhlyFRRl5pVEK3mk5uTkK4TnF@WkKOmAdAJxeqqGkZaWsaFmbHSmjbqieuz//0paSgA "Python 2 – Try It Online")
### Previous versions:
103 bytes
```
from random import*
exec['print"Hello World"','while 1:1','print randint(0,2**31-1)'][cmp(input(),'*')]
```
93 bytes
```
from random import*
i=cmp(input(),'*')
while i>0:1
print["Hello World",randint(0,2**31-1)][i]
```
[Answer]
# JavaScript (ES7), 66 bytes
```
s=>s[1]?s<'!'?Math.random()*2**31|0:eval(`for(;;);`):'Hello World'
```
[Try it online!](https://tio.run/##BcExDsIwDADAr8BkOxIVha2hdGVhZkBItZoEikyM4qoTfw93b17ZpjJ/l13WEGvqq/Vnu7ePwU6wheHKy6spnIN@kNzBuWP723dxZcExaUHvyY/UwSWK6OamRQLUSbOpxEb0iQnBAVH9Aw "JavaScript (Node.js) – Try It Online") (Hello World)
[Try it online!](https://tio.run/##BcE7DsIwDADQq4TJdiQqCltD6dqFmQEhNWoSPjJxFVeduHt47@M3r3N5L@s@S4g19VX7i97bx6Bn2MFw9eurKT4H@SLZo7Wn9nfo4uYZpyQFnSM3UQdjZBZzk8IB6ixZhWPD8sSEYKwBovoH "JavaScript (Node.js) – Try It Online") (random number)
[Try it online!](https://tio.run/##BcE7DsIwDADQq8BkO4iKwtZQurIwMyCkWk3CRyZGcdWJu4f33rywTeX1nbdZQ6ypr9af7NbeBzvCGoYLz8@mcA76QXJ75w7tb9fFhQXHpAW9Jz9SB@cooqurFglQJ82mEhvRByYEt3FAVP8 "JavaScript (Node.js) – Try It Online") (infinite loop)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~23~~ 21 bytes
```
OS¹Ḃ¿ịØ%HX’;““½,⁾ẇṭ»¤
```
[Try it online!](https://tio.run/##ATYAyf9qZWxsef//T1PCueG4gsK/4buLw5glSFjigJk74oCc4oCcwr0s4oG@4bqH4bmtwrvCpP///yo "Jelly – Try It Online")
A monadic link taking a single argument and returning `Hello World`, a random 31 bit integer or looping infinitely as per the spec. 
All options: [`*`](https://tio.run/##ATYAyf9qZWxsef//T1PCueG4gsK/4buLw5glSFjigJk74oCc4oCcwr0s4oG@4bqH4bmtwrvCpP///yo "Jelly – Try It Online")  [`*`](https://tio.run/##ATgAx/9qZWxsef//T1PCueG4gsK/4buLw5glSFjigJk74oCc4oCcwr0s4oG@4bqH4bmtwrvCpP///yAqIA)  [`*+*`](https://tio.run/##ATgAx/9qZWxsef//T1PCueG4gsK/4buLw5glSFjigJk74oCc4oCcwr0s4oG@4bqH4bmtwrvCpP///yorKg)
## Explanation
```
O                     | Convert to codepoints
 S                    | Sum
  ¹Ḃ¿                 | Loop the identity function while odd 
     ị              ¤ | Index into the following as a nilad:
      Ø%              | - 2 ** 32
        H             | - Halved
         X            | - Random integer in the range 1..2**31
          ’           | - Decrease by 1 
           ;          | - Concatenated to:
            ““½,⁾ẇṭ»  |   - "", "Hello World"
```
[Answer]
# [Befunge-93](https://github.com/catseye/Befunge-93), 54 bytes
```
~"*"-_~1+#^_"dlroW olleH">:#,_@.%*2**:*::*88:*`0:?1#+<
```
[Try it online!](https://tio.run/##S0pNK81LT/3/v05JS0k3vs5QWzkuXiklpyg/XCE/JyfVQ8nOSlkn3kFPVctIS8tKy8pKy8LCSivBwMreUFnb5v9/LW0tAA "Befunge-93 – Try It Online")
**Annotated:**
```
~"*"-                      _                ~1+                   #^_        "dlroW olleH">:#,_    @      .%*2**:*::*88:   *`0:             ?1#+<
Compare first      If equal, go right       Compare second       If equal,        Output          Exit    Modulo by 2^31   If less than      Add 1
character to       Otherwise, go left       character to       loop forever   "Hello World"                 and output     0, multiply     a random amount
'*'                and wrap around          -1 (EOF)                                                                         by 0            of times
```
The randomness is not uniform. At each increment there is a 50% chance to stop incrementing.
[Answer]
# [Python 2](https://docs.python.org/2/), ~~91~~ ~~89~~ 88 bytes
```
from random import*
def f(p):
 while'*'<p:p
 print['Hello World',getrandbits(31)][p<'!']
```
[Try it online!](https://tio.run/##LY0xDsMgEAR7XnGpziZuknTID8gPUiCKRECMhLnTBSny6zGW3Oxqi5nlrS5U7q1FoRXkXXyvtDJJ1cqHCHHg0Sj4LykH1DizYQUsqVSLz5AzwYske5y@oR74J9Xf8LiNzvKMF3QtkgBDKmA7PiFo6KmvGp05RdCNx8052w4 "Python 2 – Try It Online")
2 bytes thanks to [Jonathan Allan](https://codegolf.stackexchange.com/users/53748/jonathan-allan); 1 byte thx to [ShadowRanger](https://codegolf.stackexchange.com/users/70305/shadowranger).
[Answer]
# PowerShell, ~~60~~, 56 bytes
```
switch($args){*{'Hello World'}' * '{random}*+*{for(){}}}
```
Pretty dumb version, the only golfing technique here is omitting `Get-` in `Get-Random`.
**UPD.** Stripped down to 56 bytes by removing quotes, thanks to [veskah](https://codegolf.stackexchange.com/users/78849/Veskah)!
* [Try it online!](https://tio.run/##DcgxDoAgDADArzCYFOpH/IEzERSTak0xYWj69uqN9/Co0lslcu/jfLcWpyxHT4oKy98cVhYqYBAwgEq@C1@GM@rOEpOambsDwgc) (Hello World)
* [Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/v7g8syQ5Q0MlsSi9WLNaq1rdAyicrxCeX5STol6rrqCloF5dlJiXkp9bq6WtVZ2WX6ShWV1bW/v//3@wJAA) (random number)
* [Try it online!](https://tio.run/##DcgxDoAgDADArzCYFOpH/IEzERQStKaYMDR9e@XGe2lk7iW3ZtZH/Y7il8hXD4IC22xyO3FLoODQgXB8Et2KK8pJ7IOoqpnBDPgB) (infinite loop)
[Answer]
# [///](https://esolangs.org/wiki////), 72 bytes
```
/+*/+*// */a random number between 0 and 0//*/"Hello World"/
```
[Try it online!](https://tio.run/##FchLCoAgEADQqwwuR2H6SHWEbtBacaDFqKBFx58K3up1Cf3krkoWfwRIAVooqWYod47cIPL1MBcY4GuY3OhX57fZLX4lQjI7i1Q4apNkSNGivg "/// – Try It Online")
Here I go again, adding another cheating entry. Was I really going write my own pseudo-random generator just for this though... and in **///**?!
Instead, I interpreted the `Print` instruction very literally, as a good minion should. Everything after `Print` is outputted:
  
### `*` Prints "Hello World"
> 
> `*` → `"Hello World"`, yes, even with the quotation marks. Otherwise, I'd admit to being aware of the quotation-marks-denote-literal-string convention, which wasn't explicitly stated in the question, and doesn't exist in the language with which I'm submitting. And then I wouldn't be able to cheat with the *"Print a random number"* part. So, I'm feigning ignorance... Shhh, don't tell!
> 
> 
> 
### `​ * ​` Prints a random number between 0 and 2,147,483,647
> 
> `*` → `a random number between 0 and 0`. Lucky for me, although they didn't add the whole non-deterministic, different-number-every-time shtick in the rules, they did say *"if our language's integer maximum is smaller than 2,147,483,647"* we can use our language's *"integer maximum"* instead, so I did... There *are* no integer types in **///**, only strings. So the integer maximum is `0`, sort of...   
> Well, it shaves off a few bytes!
> 
> 
> 
### `*+*` Runs Forever
> 
> `*+*` → ![](https://i.stack.imgur.com/itQip.png). There's no `Print` instruction in this one so I can interpret it like a normal human. Replacing a pattern with itself (or another string containing itself), is the standard way to loop forever, and it's as succinct as it gets!
> 
> 
> 
  
### Note
To golf it a bit, **///** looks for `+*` & `​ *​` rather than the whole thing. This works just as well. For the infinite loop, nothing ever prints because the replacing never stops, so you'll never find out that it's prepending an infinitely long list of `*` to the beginning every time it replaces. As for printing 'a random number,' we just don't replace one of the spaces, leaving a trailing space at the end of the output. Luckily, this hurts no one and is not noticeable. Plus, how's an ignoramus like me to know how many of the trailing spaces at the end of the `Print` instruction, until the margin, were on purpose :p
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, ~~43~~ 39 bytes
```
$_=/ /?0|rand~0:/\+/?redo:"Hello World"
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3lZfQd/eoKYoMS@lzsBKP0Zb374oNSXfSskjNScnXyE8vygnRen/fy1trX/5BSWZ@XnF/3ULAA "Perl 5 – Try It Online")
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 71 bytes
```
s=>{for(;s=="*+*";);return"*"==s?"Hello World":new Random().Next()+"";}
```
[Try it online!](https://tio.run/##Xcu7CgIxEIXh3qcIU@Wibm@ctRMLsbDZWrKJBOIEMlkUxGePslZaHfg4v@OV49j2E7kt1xLpuvxOH7Ax9s@Qi7SMCNposMoWX6dCoAGRd3DwKWUx5JJG2JC/i/OFxnyTan3yjyqVAbCvZhdDidUfI3kZ5KdV6p/EbF33q2a@tjc "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-n`, 47 bytes
```
puts~/ /?rand(1<<31):~/\+/?loop{}:"Hello World"
```
[Try it online!](https://tio.run/##KypNqvz/v6C0pLhOX0HfvigxL0XD0MbG2FDTqk4/RlvfPic/v6C61krJIzUnJ18hPL8oJ0Xp/38FLYV/@QUlmfl5xf918wA "Ruby – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 65 bytes
```
#/.{"*"->"Hello World"," * "->RandomInteger[2^31-1],_:>0~Do~∞}&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7X1lfr1pJS0nXTskjNScnXyE8vygnRUlHSUFLASgYlJiXkp/rmVeSmp5aFG0UZ2yoaxirE29lZ1Dnkl/3qGNerdr/gKLMvJLoNAegKbH/AQ "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Java (JDK)](http://jdk.java.net/), 83 bytes
```
s->{for(s=s.intern();s=="*+*";);return"*"==s?"Hello World":(-1>>>1)*Math.random();}
```
[Try it online!](https://tio.run/##LU67bsMgFN3zFVdMQGvUrHUhW9Ql6pChQ5SB2DjBxWDBJVIU@dspSTudI53nqK@6Gfuf0jmdEuy09XBfAcz55GwHCTVWuAbbw1Q1usdo/flwBB3PiT2tAGMtERmtE0P2HdrgxfaffPwFXr9Oo@lQwQCypEbdhxBpkklYjyZ6ytokJeEvnLSsjQZz9IQTKdOGfBrnAnyH6HryTpu1UmrN@E7jRUTt@zDV8FLa55H9LaGZRMgo5jqLztNB6Hl2N/r4e3g7MvZwLqulFODwCw "Java (JDK) – Try It Online")
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~26~~ 23 bytes
```
l₃∈&hṢ∧2^₃₁-₁ṙw∨Ḥ⊇ᶠ³⁶tw
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/P@dRU/Ojjg61jIc7Fz3qWG4UB@I3NeoC8cOdM8sfdax4uGPJo672h9sWHNr8qHFbSfn//0oKWgpKAA "Brachylog – Try It Online")
Takes the program as a string through the input variable, and ignores the output variable. Heavily exploits the guarantee that the input is only ever one of the three valid programs: any length-three input will behave like either `" * "` or `"*+*"` depending on whether or not the first character is a space, and any other input will behave like `"*"`.
```
l₃                         The input has length 3
  ∈                        and is an element of something,
   &h                      and the input's first element
     Ṣ                     is a space
  ∈                        (if not, try some other thing it's an element of),
      ∧2^₃₁-₁              so take 2,147,483,647 and
             ṙw            print a random number between 0 and it inclusive.
               ∨           If the input's length isn't 3,
                Ḥ⊇ᶠ³⁶tw    print the 36th subsequence of "Hello, World!".
```
[Answer]
# [PHP](https://php.net/), 51 bytes
```
for(;'*'<$l=$argn[1];);echo$l?rand():'Hello World';
```
[Try it online! (Hello World)](https://tio.run/##K8go@G9jXwAk0/KLNKzVtdRtVHJsVRKL0vOiDWOtNa1TkzPyVXLsixLzUjQ0rdQ9UnNy8hXC84tyUtSt///X@pdfUJKZn1f8X9cNAA "PHP – Try It Online")
[Try it online! (Random Number)](https://tio.run/##K8go@G9jXwAk0/KLNKzVtdRtVHJsVRKL0vOiDWOtNa1TkzPyVXLsixLzUjQ0rdQ9UnNy8hXC84tyUtSt//9X0FL4l19QkpmfV/xf1w0A "PHP – Try It Online")
[Try it online! (Infinite Loop)](https://tio.run/##K8go@G9jXwAk0/KLNKzVtdRtVHJsVRKL0vOiDWOtNa1TkzPyVXLsixLzUjQ0rdQ9UnNy8hXC84tyUtSt///X0tb6l19QkpmfV/xf1w0A "PHP – Try It Online")
Takes second character of input which can be `''`, `'*'` or `'+'`. In case of `'+'` the `'*'<'+'` will be true and the loop will be infinite, else, after the loop, "Hello World" or a random number is shown. The `rand()` automatically outputs a number between 0 and `getrandmax()` which uses defined `RAND_MAX` in standard C library and by default is `2147483647` on most platforms/environments, including TIO.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 39 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Anonymous prefix lambda.
```
{'+'∊⍵:∇⍵⋄' '∊⍵:⌊2E31×?0⋄'Hello World'}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qG@qp/@jtgkG/6vVtdUfdXQ96t1q9aijHUg96m5RV4AL9XQZuRobHp5ubwAS90jNyclXCM8vyklRr/2fBjTgUW8fxKyu5kPrjR@1TQTygoOcgWSIh2fw/zQFdS11LiCpoKUAprW0tdQB "APL (Dyalog Unicode) – Try It Online")
`{` "dfn"; `⍵` is the argument:
 `'+'∊⍵:` if plus is a member of the argument:
  `∇⍵` tail recurse on argument
 `' '∊⍵` if space is a member of the argument:
  `?0` random float (0–1)
  `2E31×` scale to (0–2³¹)
  `⌊` floor
 `'Hello World'` else return the string
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 21 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
'*KgDi[ë<ižIL<Ωë”Ÿ™‚ï
```
[Try it online.](https://tio.run/##ASwA0/9vc2FiaWX//ycqS2dEaVvDqzxpxb5JTDzOqcOr4oCdxbjihKLigJrDr///Kg) (NOTE: The random buildin is pretty slow with big lists, so it might take awhile before the result is given.)
**Explanation:**
```
'*K           '# Remove all "*" from the (implicit) input
   g           # Get the length of what's remain (either 0, 1, or 2)
    D          # Duplicate this length
     i         # If the length is exactly 1:
      [        #  Start an infinite loop
     ë<i       # Else-if the length is 2:
        žI     #  Push builtin 2147483648
          L    #  Create a list in the range [1,2147483648]
           <   #  Decrease each by 1 to make the range [0,2147483647]
            Ω  #  Pop and push a random value from the list
               #  (after which the top of the stack is output implicitly as result)
     ë         # Else:
      ”Ÿ™‚ï    #  Push dictionary string "Hello World"
               #  (after which the top of the stack is output implicitly as result)
```
[See this 05AB1E tip of mine (section *How to use the dictionary?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why `”Ÿ™‚ï` is `"Hello World"`.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 32 bytes
```
It/Jw\*#;?tlJOhC*4\ÿ"Hello World
```
[Try it online!](https://tio.run/##K6gsyfj/37NE36s8RkvZ2r4kx8s/w1nLJObwfiWP1JycfIXw/KKclP//tQA "Pyth – Try It Online")
## Explanation (Python-ish)
```
I                                   # if 
  /Jw\*                             #    (J:=input()).count("*"))
 t                                  #                             - 1:
       #;                           #     try: while True: pass;except: break;
         ?                          # if (ternary)
           lJ                       #    len(J):
             O                      #     randInt(0,                    )
               C                    #                int(     , 256)
                *4\ÿ                #                    4*"ÿ"
              h                     #                                + 1
                    "Hello World    # else: (implicitly) print "Hello World"
```
[Answer]
# JavaScript, 62 Bytes, no infinite recursive
```
s=>s[1]?eval("while(s>'!');Math.random()*2**31"):'Hello World'
```
[Answer]
# [JavaScript (V8)](https://v8.dev/), 79 bytes
-2 bytes thanks VFDan
```
s=>eval([`"Hello World"`,`Math.random()*2**31|0`,`for(;;);`][s.lastIndexOf`*`])
```
[Try it online!](https://tio.run/##Xcq7DsIgFADQ3a8gnQCV@lhMSJ11MI4OTZNLWvCRK9cAIQ7@O7Zr15PzMtnEPjw/aZ0PxTUlNkebDfIWqpNFJHajgEMFK7iY9FDB@IHeXMidlPvtbzO6o8C1Fhq6Nio0MZ39YL9XBxI6UXrykdAqpDt3fDQhFjNjkk1a1/O7nHb5Aw "JavaScript (V8) – Try It Online")
[Answer]
# [Pip](https://github.com/dloscutoff/pip), ~~39~~ 35 bytes
```
IaQ'*P"Hello World"EIsQ@aPRRmE{T0a}
```
[Try it online!](https://tio.run/##K8gs@P/fMzFQXStAySM1JydfITy/KCdFydWzONAhMSAoKNe1OsQgsfb///8KWgoA "Pip – Try It Online")
Simple if else based program, prints random integer between 0 and 1000.
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 16 bytes
```
×=[kh|tð=[k×ʀ℅|{
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=5&code=%C3%97%3D%5Bkh%7Ct%C3%B0%3D%5Bk%C3%97%CA%80%E2%84%85%7C%7B&inputs=*&header=&footer=) The `5` flag is just so that you don't have to wait as long for it to timeout. Even at the default 60 second timeout, this times out on  `*` , but you can see that it works by replacing `k×` with a smaller number.
Currently, this beats all other answers.
Explanation:
```
                  # Implicit input
×=[               # If input = "*":
   kh             #   Push "Hello World"
     |tð=[        # Else if last character of input = " ":
          k×      #   Push 2147483648
            ʀ     #   Range [0, 2147483648]
             ℅    #   Random integer from range
              |   #     Else:
               {  #       While True:  (Infinite loop)
                  # Implicit output
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 30 bytes
```
Ｗ№θ*Ｆ⁼θ*≔Hello Worldθ∨θＩ‽Ｘ²¦³¹
```
[Try it online!](https://tio.run/##RYsxDsIwDAB3XmFlcqowAGMnVCGxUbEwW22gkUysOC19vqETN57uhol0EGKzdUocATtZ8owlgGuc9/AUBbyUhbj@5bnW9MrorpFZ4CHKowtQfLvrNf3um25tR3XGO@VR3tjLGhWPAU4Hv9GaQQO2//AX "Charcoal – Try It Online") Link is to verbose version of code. Abuses Charcoal's default input format which splits on spaces if there is only one line, thus the random number input actually looks like three inputs. Explanation:
```
Ｗ№θ*
```
Repeat while the first input contains a `*`.
```
Ｆ⁼θ*
```
If the first input is a `*` only...
```
≔Hello Worldθ
```
... then replace it with `Hello World`, thus causing the loop to terminate. `*+*` doesn't get replaced, resulting in an infinite loop.
```
∨θ
```
If the first input is not empty then output it.
```
Ｉ‽Ｘ²¦³¹
```
But if it is empty then output a random integer in the desired range.
[Answer]
# [Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 78 bytes
```
z:"Hello World"
`y
xR2147483647
x:?
a:"*"
b:" * "
c:"*+*"
Ix=a,Oz
Ix=b,O
Wx=c,
```
[Try it online!](https://tio.run/##S0xJKSj4/7/KSskjNScnXyE8vygnRYkroZKrIsjI0MTcxMLYzMScq8LKnivRSklLiSvJSklBS0GJKxnI0wbyPStsE3X8q0B0ko4/V3iFbbLO////wZIA "Add++ – Try It Online")
## Explanation
```
z:"Hello World"	; Set z = "Hello World"
`y		; Set y as the active variable
xR2147483647	; Set y to a random number between 0 and 2147483647
x:?		; Set x to the input
a:"*"		; Set a = "*"
b:" * "		; Set b = " * "
c:"*+*"		; Set c = "*+*"
Ix=a,		; If x == a then...
	Oz	;	...output z
Ix=b,		; If x == b then...
	O	;	...output y
Wx=c,		; While x == c then...
		;	...do nothing
```
[Answer]
# Commodore BASIC (VIC-20, C64, TheC64Mini etc) - 170 tokenize BASIC bytes
```
 0a%=32767:goS9:b$=leF(b$,len(b$)-1):ifb$="*"tH?"hello world
 1ifb$=" * "tH?int(rN(ti)*a%)
 2ifb$="*+*"tHfOi=.to1:i=.:nE
 3end
 9b$="":fOi=.to1:geta$:i=-(a$=cH(13)):b$=b$+a$:?a$;:nE:reT
```
I think to do this more accurately, I'll have to delve into the weird world of 6502 assembly language, but this is a first draft.
First point, the `INPUT` keyword in Commodore BASIC ignores white spaces, so the sub-routine at line `9` is a quick-and-dirty way to accept keyboard entries including spaces.
Second point, Commodore BASIC integers have a range of 16-bit signed, so -32768 to +32767 [source](https://www.c64-wiki.com/wiki/Variable) - so I've kept the random number generated to 0 - 32767 inclusive
]