Random Number in HUD?

Discuss how to create custom stats, reports and HUD profiles and share your creations.

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Re: Random Number in HUD?

Postby SuperJon » Sun Aug 23, 2020 8:39 pm

Just got this to work. Thanks!!

One minor thing though that I'm hoping is an easy fix.

The random number that is generated is formatted like 54.000000 or 13.00000

Is there a way to get it so it just shows the number without the decimal and zeroes?
SuperJon
 
Posts: 3
Joined: Tue Jun 17, 2008 11:42 pm

Re: Random Number in HUD?

Postby Flag_Hippo » Mon Aug 24, 2020 5:17 am

Check the 'Format Type' of the statistic on its 'Definition' tab in 'Configure -> Statistics'. You can also specify the amount of decimal places for a statistic in the HUD Profile Editor under 'Item Properties'.
Flag_Hippo
Moderator
 
Posts: 15169
Joined: Tue Jan 31, 2012 7:50 am

Re: Random Number in HUD?

Postby puich » Sat Nov 14, 2020 7:47 pm

Hey

I'd like to put in my hud for my spin and go tables but it doesn't seem to work.
Attachments
Capture d’écran 2020-11-15 à 00.41.52.png
stat name
Capture d’écran 2020-11-15 à 00.43.47.png
hud options
Capture_d_écran_15_11_2020_00_44.png
Hud
puich
 
Posts: 49
Joined: Tue Dec 25, 2012 4:28 pm

Re: Random Number in HUD?

Postby puich » Sat Nov 14, 2020 7:49 pm

Can't post more than 3 attachment and this is my column stat
Attachments
Capture d’écran 2020-11-15 à 00.41.28.png
and this is my column
puich
 
Posts: 49
Joined: Tue Dec 25, 2012 4:28 pm

Re: Random Number in HUD?

Postby WhiteRider » Sun Nov 15, 2020 5:04 am

Since this is a tournament stat you will need to replace live_cash_table with live_tourney_table in your column.
WhiteRider
Moderator
 
Posts: 54017
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Random Number in HUD?

Postby SupremeLeader » Fri Sep 13, 2024 8:15 pm

I'm trying to get more than one random number per cycle. Two things:

1. I modified the original expression but I'm not sure what's happening under the hood:
Code: Select all
(SELECT extract(milliseconds from now())::int * 7 % 100) * (cnt_hands / cnt_hands)


I multiplied by 7 then did % 100. It does give me a random number between 0-100, however I'm not sure if this number would be inherently biased?

2. I asked ChatGPT to generate valid SQL for random numbers.:
Code: Select all
SELECT FLOOR(RANDOM() * 100) + 1;


However PT4 says this is not valid SQL. Why?
SupremeLeader
 
Posts: 4
Joined: Wed Aug 18, 2021 12:19 am

Re: Random Number in HUD?

Postby SupremeLeader » Fri Sep 13, 2024 9:43 pm

SupremeLeader wrote:I'm trying to get more than one random number per cycle. Two things:

1. I modified the original expression but I'm not sure what's happening under the hood:
Code: Select all
(SELECT extract(milliseconds from now())::int * 7 % 100) * (cnt_hands / cnt_hands)


I multiplied by 7 then did % 100. It does give me a random number between 0-100, however I'm not sure if this number would be inherently biased?


Regarding point 1, I asked ChatGPT. The distribution won't be uniform, but for our purposes it's close enough: https://imgur.com/07xr2dv

So if you need more numbers just multiply by some random number and use the modulo 100 function. :)
SupremeLeader
 
Posts: 4
Joined: Wed Aug 18, 2021 12:19 am

Previous

Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: No registered users and 23 guests

cron