}
final FieldMapper<?> mapper = SearchContext.current().mapperService().smartNameFieldMapper("_uid");
if (mapper == null) {
// mapper could be null if we are on a shard with no docs yet, so this won't actually be used
return new RandomScoreFunction();
}
if (seed == -1) {
seed = Longs.hashCode(parseContext.nowInMillis());
}
final ShardId shardId = SearchContext.current().indexShard().shardId();
final int salt = (shardId.index().name().hashCode() << 10) | shardId.id();
final IndexFieldData<?> uidFieldData = SearchContext.current().fieldData().getForField(mapper);
return new RandomScoreFunction(seed, salt, uidFieldData);
}