• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Pick Random Line

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Takes input either from a file (drag and drop on the executable supported) or from typing with one "item" per line. Click on "Pick One" and it will select a random line and place it in the result textbox where it can be copied/manipulated. This is great for having a computer make up your mind when you can't.

Requires .NET Framework 4.0 (Client Profile).



In 1.1, I added the "Weighted Delimiter" field which, if it contains something, will attempt to split the line with the first part being the weight and the second part being the value. For example, if I set "Weighted Delimiter" to a semicolon (;) and then input this line: 2.1;MyValue MyValue would be weighted to 2.1 (default is 1.0). If there was another line containing NormalValue, MyValue should get picked 2.1 times more frequently than NormalValue.

Here's an example of what I used to test. I'm using /// for the delimiter.


Note: Due to rounding errors, the last item will always be slightly more preferred than the rest. In my test, Mercenaries 2 had a percentage of 0.078740157480315 while Supreme Commander 2 had a percentage of 0.078740157480315. They matched in that case but in effect, it is adding 0.00000000000000011 to the last. This isn't likely going to matter unless you're doing something scientific but something you should be aware of.

If you want to eliminate that rounding error, theoretically, you could add a 0///value at the very end. It should completely eliminate that 0.00000000000000011 from picking a line.

Version history:
-1.2.0: Fixed bug where last line wouldn't be picked if not using weights. Added drag and drop for files on the file name box and text on the main text box.
-1.1.0: Added the ability to weight lines. See the above "spoiler" for details.
-1.0.0: First release.
 

Attachments

  • pick_random_line_1_2.zip
    44.8 KB · Views: 209
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Uploaded 1.1.0. It nows supports weighting lines. Details of how to use that feature are in the "Weighted Lines" spoiler. If you don't use that feature, it is functionally identical to 1.0.0.
 

TheMailMan78

Big Member
Joined
Jun 3, 2007
Messages
22,599 (3.67/day)
Location
'Merica. The Great SOUTH!
System Name TheMailbox 5.0 / The Mailbox 4.5
Processor RYZEN 1700X / Intel i7 2600k @ 4.2GHz
Motherboard Fatal1ty X370 Gaming K4 / Gigabyte Z77X-UP5 TH Intel LGA 1155
Cooling MasterLiquid PRO 280 / Scythe Katana 4
Memory ADATA RGB 16GB DDR4 2666 16-16-16-39 / G.SKILL Sniper Series 16GB DDR3 1866: 9-9-9-24
Video Card(s) MSI 1080 "Duke" with 8Gb of RAM. Boost Clock 1847 MHz / ASUS 780ti
Storage 256Gb M4 SSD / 128Gb Agelity 4 SSD , 500Gb WD (7200)
Display(s) LG 29" Class 21:9 UltraWide® IPS LED Monitor 2560 x 1080 / Dell 27"
Case Cooler Master MASTERBOX 5t / Cooler Master 922 HAF
Audio Device(s) Realtek ALC1220 Audio Codec / SupremeFX X-Fi with Bose Companion 2 speakers.
Power Supply Seasonic FOCUS Plus Series SSR-750PX 750W Platinum / SeaSonic X Series X650 Gold
Mouse SteelSeries Sensei (RAW) / Logitech G5
Keyboard Razer BlackWidow / Logitech (Unknown)
Software Windows 10 Pro (64-bit)
Benchmark Scores Benching is for bitches.
Just get married. You will never have to make up your mind again. She will do it for you and you don't even need to install .NET Framework 4.0
 

manofthem

WCG-TPU Team All-Star!
Joined
Jan 9, 2011
Messages
10,960 (2.26/day)
Location
Florida
Processor 3900X @ 4.0
Motherboard Asus ROG Strix X570-E
Cooling DeepCool Castle 360EX
Memory G Skill Trident Z Neo 32GB 3600
Video Card(s) RX 5700 XT Pulse
Storage Sabrent Rocket Q 1TB
Display(s) LG 34UC88
Case Thermaltake P3
Power Supply Super Flower Leadex III 750w
Mouse Logitech G900
Keyboard G Skill KM570 MX Silver
Software Windows 10 Pro
So Ford this would be good for picking a winner for the next game giveaway? I'm all for it if so!
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Yeah, that's what it was originally created for. The weighting was added to make it easier to decide what game to play (lower weights for games we've already beat/started).
 

manofthem

WCG-TPU Team All-Star!
Joined
Jan 9, 2011
Messages
10,960 (2.26/day)
Location
Florida
Processor 3900X @ 4.0
Motherboard Asus ROG Strix X570-E
Cooling DeepCool Castle 360EX
Memory G Skill Trident Z Neo 32GB 3600
Video Card(s) RX 5700 XT Pulse
Storage Sabrent Rocket Q 1TB
Display(s) LG 34UC88
Case Thermaltake P3
Power Supply Super Flower Leadex III 750w
Mouse Logitech G900
Keyboard G Skill KM570 MX Silver
Software Windows 10 Pro
Very cool, I'll try it out this weekend! Thanks
 

manofthem

WCG-TPU Team All-Star!
Joined
Jan 9, 2011
Messages
10,960 (2.26/day)
Location
Florida
Processor 3900X @ 4.0
Motherboard Asus ROG Strix X570-E
Cooling DeepCool Castle 360EX
Memory G Skill Trident Z Neo 32GB 3600
Video Card(s) RX 5700 XT Pulse
Storage Sabrent Rocket Q 1TB
Display(s) LG 34UC88
Case Thermaltake P3
Power Supply Super Flower Leadex III 750w
Mouse Logitech G900
Keyboard G Skill KM570 MX Silver
Software Windows 10 Pro
Hey Ford, beer me a minute of your time (haha, Office reference). Can you look to see if you get the same thing that i'm getting... If i input say 10 numbers/names, it seems to never choose the last one. I tried with 4, 10, and 11 entries. These are just normal, nonweighted entries. Maybe it's user error, but i'd appreciate the insight.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
You're right. I'm sure I checked for that but must have some how broke it. I'll see about fixing it.

Also, I wanted to add drag n drop support so I might as well do that too while I'm at it.
 

manofthem

WCG-TPU Team All-Star!
Joined
Jan 9, 2011
Messages
10,960 (2.26/day)
Location
Florida
Processor 3900X @ 4.0
Motherboard Asus ROG Strix X570-E
Cooling DeepCool Castle 360EX
Memory G Skill Trident Z Neo 32GB 3600
Video Card(s) RX 5700 XT Pulse
Storage Sabrent Rocket Q 1TB
Display(s) LG 34UC88
Case Thermaltake P3
Power Supply Super Flower Leadex III 750w
Mouse Logitech G900
Keyboard G Skill KM570 MX Silver
Software Windows 10 Pro
You're right. I'm sure I checked for that but must have some how broke it. I'll see about fixing it.

Also, I wanted to add drag n drop support so I might as well do that too while I'm at it.

That would be terrific. I tried to drag and drop something earlier, just not thinking, but that would be pretty awesome.

With the other issue, the temporary workaround is to just add another line, anything I suppose, and it'll suite me just fine. Thanks for looking into, and thanks for the great utility, really good for giveaways lol!
:toast:
 
Joined
Aug 10, 2007
Messages
4,267 (0.70/day)
Location
Sanford, FL, USA
Processor Intel i5-6600
Motherboard ASRock H170M-ITX
Cooling Cooler Master Geminii S524
Memory G.Skill DDR4-2133 16GB (8GB x 2)
Video Card(s) Gigabyte R9-380X 4GB
Storage Samsung 950 EVO 250GB (mSATA)
Display(s) LG 29UM69G-B 2560x1080 IPS
Case Lian Li PC-Q25
Audio Device(s) Realtek ALC892
Power Supply Seasonic SS-460FL2
Mouse Logitech G700s
Keyboard Logitech G110
Software Windows 10 Pro
Bug confirmed.

random-line-bug.png


It just won't pick that last line ;)
 

qubit

Overclocked quantum bit
Joined
Dec 6, 2007
Messages
17,865 (2.99/day)
Location
Quantum Well UK
System Name Quantumville™
Processor Intel Core i7-2700K @ 4GHz
Motherboard Asus P8Z68-V PRO/GEN3
Cooling Noctua NH-D14
Memory 16GB (2 x 8GB Corsair Vengeance Black DDR3 PC3-12800 C9 1600MHz)
Video Card(s) MSI RTX 2080 SUPER Gaming X Trio
Storage Samsung 850 Pro 256GB | WD Black 4TB | WD Blue 6TB
Display(s) ASUS ROG Strix XG27UQR (4K, 144Hz, G-SYNC compatible) | Asus MG28UQ (4K, 60Hz, FreeSync compatible)
Case Cooler Master HAF 922
Audio Device(s) Creative Sound Blaster X-Fi Fatal1ty PCIe
Power Supply Corsair AX1600i
Mouse Microsoft Intellimouse Pro - Black Shadow
Keyboard Yes
Software Windows 10 Pro 64-bit
Typical little utility to write for when you have too much time on your hands. I like it. :)

@mailman: it sounds like you need to move on to Wife 2.0. ;)
 

manofthem

WCG-TPU Team All-Star!
Joined
Jan 9, 2011
Messages
10,960 (2.26/day)
Location
Florida
Processor 3900X @ 4.0
Motherboard Asus ROG Strix X570-E
Cooling DeepCool Castle 360EX
Memory G Skill Trident Z Neo 32GB 3600
Video Card(s) RX 5700 XT Pulse
Storage Sabrent Rocket Q 1TB
Display(s) LG 34UC88
Case Thermaltake P3
Power Supply Super Flower Leadex III 750w
Mouse Logitech G900
Keyboard G Skill KM570 MX Silver
Software Windows 10 Pro

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.

manofthem

WCG-TPU Team All-Star!
Joined
Jan 9, 2011
Messages
10,960 (2.26/day)
Location
Florida
Processor 3900X @ 4.0
Motherboard Asus ROG Strix X570-E
Cooling DeepCool Castle 360EX
Memory G Skill Trident Z Neo 32GB 3600
Video Card(s) RX 5700 XT Pulse
Storage Sabrent Rocket Q 1TB
Display(s) LG 34UC88
Case Thermaltake P3
Power Supply Super Flower Leadex III 750w
Mouse Logitech G900
Keyboard G Skill KM570 MX Silver
Software Windows 10 Pro
Top