Most of the temporal data mining tasks require representations to capture important characteristics of time series. Representation learning is challenging when time series differ in distributional characteristics and/or show irregularities such as varying lengths and missing observations. Moreover, when time series are multivariate, interactions between variables should be modeled efficiently. This study proposes a unified, flexible time series representation learning framework for both univariate and multivariate time series called Rand-TS. Rand-TS models density characteristics of each time series as a time-varying Gaussian distribution using random decision trees and embeds density information into a sparse vector. Rand-TS can work with time series of various lengths and missing observations, furthermore, it allows using customized features. We illustrate the classification performance of Rand-TS on 113 univariate, 19 multivariate along with 15 univariate time series with varying lengths from UCR database. The results show that in addition to its flexibility, Rand-TS provides competitive classification performance.