randomOrNull

abstract fun randomOrNull(random: Random): T?

从集合中随机返回一个元素,如果集合为空则返回 null。

Return

随机元素或 null

Parameters

random

随机数生成器