INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Issue with using math(rand(n)) in handheld filename rule  (Read 689 times)

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2661
Issue with using math(rand(n)) in handheld filename rule
« on: July 01, 2019, 12:05:36 pm »

The random function on my car headunit is absolutely terrible so I've been trying to get MC to prefix a random number from 1-9999 on my track filenames so I can just play the songs "in order" on my stereo and bypass the built-in random function.

But when I use the filename rule:

Code: [Select]
math(rand(9999)) - [Artist] - [Name]
All that is being output is the random number and not the rest of the filename attributes. Occasionally there will be a song with a weird subset of [Name] and/or [Artist] that is transferred as well. You can see the output in the attached image.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4226
Re: Issue with using math(rand(n)) in handheld filename rule
« Reply #1 on: July 01, 2019, 12:13:12 pm »

IIRC this doesn't work (but I might be confusing this issue with something else...)

I can't find the thread exactly now (I think I posted about it once) but I did find a reference to https://yabb.jriver.com/interact/index.php/topic,111180.0.html which covers similar ground

Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Issue with using math(rand(n)) in handheld filename rule
« Reply #2 on: July 01, 2019, 12:22:59 pm »

I don't think the rand() function inside the math function is all that nice.

So next build:
NEW: Added a Rand(...) expression function to generate a random number between the two bounds specified.  The last optional parameter specifies if you want integer or decimal.
Logged
Matt Ashland, JRiver Media Center

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2661
Re: Issue with using math(rand(n)) in handheld filename rule
« Reply #3 on: July 01, 2019, 01:05:57 pm »

Excellent, I also noticed that the math(rand(n)) output wasn't very random so hopefully the new expression function works better!
Logged
Pages: [1]   Go Up