Quantcast

[Gambas Bug Tracker] Bug #1058: Gambas Rnd (Web programming)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1058: Gambas Rnd (Web programming)

bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1058&from=L21haW4-

ADMINISTRATOR reported a new bug.

Summary
-------

Gambas Rnd (Web programming)

Type             : Bug
Priority         : Medium
Gambas version   : 3.9
Product          : Unknown


Description
-----------

I created a sample code:

<code>
<%
Dim randoms As String
Dim I As Integer
%>

<html>
<body>
<% For I = 1 To 6%>
<%randoms &= Hex$(Int(Rnd(65536)), 4)%>
<%Next%>
<h1>Gambas web application</h1>
<table border="1" cellpadding="4" cellspacing="0">
  <tr>
    <th><%=randoms%></th>
    <th>Value</th>
  </tr>
  <tr>
    <td></td>
    <td></td>
  </tr>
</table>
<%randoms = Null%>
</body>
</html>
</code>

Run with the embedded HTTP server.
each page refresh it gives me the same value
I tried also with =. It does not work. Always returns the same value. It seems as if RND did not work in this case

However, if you run a script gbw3, then this works. If I run through apache2, nginx, lighttpd, then also works.

Only in the embedded HTTP server does not work
I can also refer to this function:

<code>
Public Function getrandom() As String
  Dim uniqueid As String
  Dim I As Integer
  For I = 1 To 6
    uniqueid &= Hex$(Int(Rnd(65536)), 4)
  Next
  Return uniqueid
  uniqueid = Null
End
</code>

However, any reference to this function returns the same value, only when running is using the embedded HTTP server


System information
------------------

[System]
Gambas=3.9.2
OperatingSystem=Linux
Kernel=4.8.15-1-MANJARO
Architecture=x86_64
Distribution=Manjaro Linux
Desktop=KDE5
Theme=Breeze
Language=pl_PL.UTF-8
Memory=3704M

[Libraries]
Cairo=libcairo.so.2.11400.8
Curl=libcurl.so.4.4.0
DBus=libdbus-1.so.3.14.9
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.1002.0
GTK+2=libgtk-x11-2.0.so.0.2400.31
GTK+3=libgtk-3.so.0.2200.5
OpenGL=libGL.so.1.2.0
Poppler=libpoppler.so.65.0.0
QT4=libQtCore.so.4.8.7
QT5=libQt5Core.so.5.7.0
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6

[Environment]
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=/usr/share/xsessions/plasma
DISPLAY=:0
GB_GUI=gb.qt5
GS_LIB=<home>/.fonts
GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:<home>/.gtkrc-2.0:<home>/.config/gtkrc-2.0
GTK_MODULES=canberra-gtk-module
GTK_RC_FILES=/etc/gtk/gtkrc:<home>/.gtkrc:<home>/.config/gtkrc
HOME=<home>
KDE_FULL_SESSION=true
KDE_MULTIHEAD=false
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
LANG=pl_PL.UTF-8
LC_ADDRESS=pl_PL.UTF-8
LC_IDENTIFICATION=pl_PL.UTF-8
LC_MEASUREMENT=pl_PL.UTF-8
LC_MONETARY=pl_PL.UTF-8
LC_NAME=pl_PL.UTF-8
LC_NUMERIC=pl_PL.UTF-8
LC_PAPER=pl_PL.UTF-8
LC_TELEPHONE=pl_PL.UTF-8
LC_TIME=pl_PL.UTF-8
LOGNAME=<user>
MAIL=/var/spool/mail/<user>
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
PWD=<home>
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
QT_NO_GLIB=1
SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/690,unix/<hostname>:/tmp/.ICE-unix/690
SHELL=/bin/bash
SHLVL=1
TZ=:/etc/localtime
USER=<user>
XAUTHORITY=/tmp/xauth-1000-_0
XCURSOR_THEME=breeze_cursors
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=c1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=x11
XDG_VTNR=1
_=/usr/lib/kf5/start_kdeinit_wrapper



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1058: Gambas Rnd (Web programming)

bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1058&from=L21haW4-

Comment #1 by ADMINISTRATOR:

I think I understood: the embedded HTTP server is the gambas interperter, and it forks to handle a request. So the random number generator has always the same state.
I will try to fix that.

In the meanwhile, as a workaround, just use the Randomize function before using Rnd.

ADMINISTRATOR changed the state of the bug to: Accepted.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1058: Gambas Rnd (Web programming)

bugtracker
In reply to this post by bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1058&from=L21haW4-

Comment #2 by Michał GŁOWIENKA:

Well, thank you for your answer



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1058: Gambas Rnd (Web programming)

bugtracker
In reply to this post by bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1058&from=L21haW4-

Comment #3 by Benoît MINISINI:

It should be fixed in revision #8089.

Benoît MINISINI changed the state of the bug to: Fixed.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...