I assume that you mean random recording when you say "random from ndb".
If you use an automatic identifier, you can use the following approach. (how your sparse identifier will affect the success of this).
use random.randrange(start, stop)with a start of 0, stop being (2 ^ 52) -1, given the new identifier allocation policy.
, , , . < .
10 ( )
random.choice(seq) , .
key.get() .
< 1000
, random.choice() a db.get() . , . , , 1 , memcache.