Node to generate Random duration in various format (HH:mm:ss, seconds, milliseconds, ISO8601)

Hi,

I needed to generate a random duration. Instead of developing it in a function node, I developed a small and simple node to accomplish this :

Your comments are very welcome :wink:

I am interested in the use case for a time duration in that format.

Hi,
I use this node to generate a random duration in combination with the presencefaker and Sonos Plus nodes. This setup allows me to play an MP3 file that simulates presence with everyday life sounds. I want the track to start at a random point and be played only for a duration that is also random. This way, I can have sounds that are always different without having to manage playlists.

It's indeed a good idea to add the option to choose the output format.

Regards

I would have thought that you would want the duration in milliseconds or seconds for that, rather than as a string.

Hi, nop, the Sonos Plus node needs a string in HH:mm:ss.
I just update the node to select the wanted format (including milliseconds and seconds)

I find that very strange.

Maybe, but here : A.1 Universal Node · hklages/node-red-contrib-sonos-plus Wiki · GitHub

I was not doubting what you said, just commenting that it is surprising not to at least give the option of a duration in seconds.

Maybe because it is more easy to manipulate music with this format, as it is more humanly understable :wink: