@payalsahu_
In a recent interview, I was asked to implement a function that gives a totally random number from a given array, and each number has an equally likely probability of being selected. No built-in functions allowed.
Viewing enriched Twitter post
In a recent interview, I was asked to implement a function that gives a totally random number from a given array, and each number has an equally likely probability of being selected. No built-in functions allowed.
{
"score": 0.34,
"score_components": {
"author": 0.09,
"engagement": 0.0,
"quality": 0.04000000000000001,
"source": 0.135,
"nlp": 0.05,
"recency": 0.025
},
"scored_at": "2026-10-17T01:07:54.251821",
"import_source": "api_import",
"source_tagged_at": "2026-10-17T01:07:54.251831",
"enriched": true,
"enriched_at": "2026-10-17T01:07:54.251834"
} {
"type": "tweet",
"id": "2110754485924663594",
"url": "https://x.com/payalsahu_/status/2110754485924663594",
"twitterUrl": "https://twitter.com/payalsahu_/status/2110754485924663594",
"text": "In a recent interview, I was asked to implement a function that gives a totally random number from a given array, and each number has an equally likely probability of being selected. No built-in functions allowed.",
"source": "Twitter for iPhone",
"retweetCount": 5,
"replyCount": 59,
"likeCount": 1697,
"quoteCount": 11,
"viewCount": 253524,
"createdAt": "Thu Oct 15 15:27:40 +0000 2026",
"lang": "en",
"bookmarkCount": 353,
"isReply": false,
"inReplyToId": null,
"conversationId": "2110754485924663594",
"displayTextRange": [
0,
213
],
"inReplyToUserId": null,
"inReplyToUsername": null,
"author": {
"type": "user",
"userName": "payalsahu_",
"url": "https://x.com/payalsahu_",
"twitterUrl": "https://twitter.com/payalsahu_",
"id": "1908918237460414465",
"name": "Payal 🪄✨",
"isVerified": false,
"isBlueVerified": false,
"verifiedType": null,
"profilePicture": "https://pbs.twimg.com/profile_images/2035128730906238978/rDgdFxCi_normal.jpg",
"coverPicture": "https://pbs.twimg.com/profile_banners/1908918237460414465/1758821118",
"description": "",
"location": "Behind You",
"followers": 948,
"following": 577,
"status": "",
"canDm": false,
"canMediaTag": false,
"createdAt": "Sun Apr 06 16:22:42 +0000 2025",
"entities": {
"description": {
"urls": []
},
"url": {}
},
"fastFollowersCount": 0,
"favouritesCount": 37411,
"hasCustomTimelines": true,
"isTranslator": false,
"mediaCount": 50,
"statusesCount": 1877,
"withheldInCountries": [],
"affiliatesHighlightedLabel": {},
"possiblySensitive": false,
"pinnedTweetIds": [],
"profile_bio": {
"description": "21 | https://t.co/UAUweeJJKg | SWE Intern'26 @Google | Technical Intern'25 @Cisco | Jaha Zindagi le jaye",
"entities": {
"description": {
"urls": [
{
"display_url": "linkedin.com/in/payal-sahu1",
"expanded_url": "https://www.linkedin.com/in/payal-sahu1",
"indices": [
5,
28
],
"url": "https://t.co/UAUweeJJKg"
}
],
"user_mentions": [
{
"id_str": "",
"indices": [
45,
52
],
"name": "",
"screen_name": "Google"
},
{
"id_str": "",
"indices": [
75,
81
],
"name": "",
"screen_name": "Cisco"
}
]
}
}
},
"isAutomated": false,
"automatedBy": null
},
"extendedEntities": {},
"card": null,
"place": {},
"entities": {},
"quoted_tweet": null,
"retweeted_tweet": null,
"isLimitedReply": false,
"communityInfo": null,
"article": null
}