Page 1 of 3

Random Number in HUD?

PostPosted: Tue Apr 02, 2013 6:43 am
by Olaf72
I'd like to have a random Number in the HUD.
It should change every HUD-update.

It doesn't have to be that perfectly random. The milliseconds or seconds of an actual timestamp would do.

Re: Random Number in HUD?

PostPosted: Tue Apr 02, 2013 8:04 am
by kraada
This can be done. What kind of precision did you want - from 1 to 10, 1 to 100, 1 to 1000?

Re: Random Number in HUD?

PostPosted: Tue Apr 02, 2013 8:41 am
by Olaf72
Great - thanks.

1 to 100 would be fine :)

Re: Random Number in HUD?

PostPosted: Tue Apr 02, 2013 10:45 am
by kraada
Create a new column as follows:
live_random_number: (SELECT extract(milliseconds from now())::int % 100) * (live_cash_table.amt_bb / live_cash_table.amt_bb)

This will give you the last two digits of the current time to the millisecond. Create a stat using it and you should see it working in your HUD directly.

Re: Random Number in HUD?

PostPosted: Tue Apr 02, 2013 3:30 pm
by Olaf72
Didn't work.
But this one does.

(SELECT extract(milliseconds from now())::int % 100) * max(cash_hand_summary.id_hand / cash_hand_summary.id_hand)

thanks.

Re: Random Number in HUD?

PostPosted: Tue Apr 02, 2013 4:23 pm
by kraada
That one works but you must name the column starting with "live_". It should work better for you as time goes on as the live stats are just based on the very last hand data and will be queried separately.

Re: Random Number in HUD?

PostPosted: Wed Apr 03, 2013 10:43 am
by Olaf72
Aha... That live_..... columns don't work with Pokerstars-Zoom-Tables? right?

Re: Random Number in HUD?

PostPosted: Wed Apr 03, 2013 12:07 pm
by kraada
I think it still should but I haven't tested it.

Re: Random Number in HUD?

PostPosted: Fri Mar 20, 2015 1:16 pm
by QqNwG207phyYezgo
Hi,

I want to add 3 a 6 random numbers in my HUD.

I have used the following for first one and it works.
live_random_number: (SELECT extract(milliseconds from now())::int % 100) * (live_cash_table.amt_bb / live_cash_table.amt_bb)

The moment I copy the above in a second column (in an attempt to create another random number) it just generates the same output as the first column.
Something like
SELECT RAND() AS [live_random_number02]
and some variations upon it also does not works.

Do you know a method to create multiple random numbers?

Thanks in advance

Re: Random Number in HUD?

PostPosted: Fri Mar 20, 2015 2:28 pm
by kraada
You'll get the same number for your second column because the query for live tables are all run at the same instant - so you'll only get one millisecond answer.

The actual postgres function is called random() so what's probably easiest is to create a custom non cached column that just reads:

select random()

and then a stat whose value expression is that number. random() gives you a random number between 0 and 1 -- see here for more details.

highfalutin