This paper presents RandomBug, a novel real-time path planning algorithm, for an autonomous mobile agent in completely unknown environment. According to this algorithm, all the planned paths are described and stored in the form of vectors. When the agent moves along the planned paths, it only considers the rotation angle and the movement distance in a single direction. The algorithm combines range sensor data with a safety radius to determine the blocking obstacles and calculate the shorter path by choosing the random intermediate points. When there is obstacle blocking in the current path, the intermediate points will be calculated randomly and the planned path will be regenerated by inserting the selected random intermediate points. Simulation results are given to show the effectiveness of the proposed algorithm.