She picked a book off the shelf at random.

Literal

She [topic-は] random [adverbial-に] shelf [from-から] one-volume 's book [object-を] took.

行き当たりばったり is a vivid set phrase: 行き当たる ('to bump into') + ばったり (a 擬態語 mimetic for sudden encounter or collapse), forming an idiom for 'haphazard, random, going as the wind blows.' Often used disapprovingly for unplanned approaches: 行き当たりばったりの旅 ('an unplanned trip'). The adverbial に sets it as the manner of action. 一冊 uses the counter 冊 (さつ) for bound volumes — books, magazines, notebooks. 棚から marks 'from the shelf.'