Ur/Web Examples
Check-in [06fb318b2b]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:- this change has remained uncommitted since 2015-05-18 00:07:20, not sure if it is useful for sensible, but commit anyway...
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:06fb318b2b360c42aec29f543979b9820cf9c99c
User & Date: beyert 2016-08-17 04:28:04
Context
2016-08-17
04:47
finally commit experimental JSON RPC client, written in Haskell, called by Ur/Web via the C FFI, written at some point from 2015-02-15 15:37:39 to 2015-08-11 22:08:20 (via timestamps). It definitely worked the last time that I tried running it, albeit it was highly experimental... check-in: 34f12621b3 user: beyert tags: trunk
04:28
- this change has remained uncommitted since 2015-05-18 00:07:20, not sure if it is useful for sensible, but commit anyway... check-in: 06fb318b2b user: beyert tags: trunk
2015-03-01
23:54
- slight adjustment to required libraries check-in: d27e9105c6 user: beyert tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pseudoRandom/random.c.

3
4
5
6
7
8
9
10
11
12
13
14


15
16
17
18
19
20
21
#include <time.h>
#include <unistd.h>

#include <urweb.h>

struct timeval ti;

uw_Basis_int uw_Random_updateSeed(uw_context ctx, uw_unit u) {
  gettimeofday(&ti, NULL);
  srand(ti.tv_usec);
  // in very rare cases, usleep is needed here
  usleep(10); }



uw_Basis_int uw_Random_generateWeak(uw_context ctx, uw_unit u) {
  return rand(); }

uw_Basis_int uw_Random_generateSafe(uw_context ctx, uw_unit u) {
  uw_Random_updateSeed(ctx, u);
  return uw_Random_generateWeak(ctx, u); }







|



|
>
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <time.h>
#include <unistd.h>

#include <urweb.h>

struct timeval ti;

uw_Basis_unit uw_Random_updateSeed(uw_context ctx, uw_unit u) {
  gettimeofday(&ti, NULL);
  srand(ti.tv_usec);
  // in very rare cases, usleep is needed here
  usleep(10);
  /* return(); */
}

uw_Basis_int uw_Random_generateWeak(uw_context ctx, uw_unit u) {
  return rand(); }

uw_Basis_int uw_Random_generateSafe(uw_context ctx, uw_unit u) {
  uw_Random_updateSeed(ctx, u);
  return uw_Random_generateWeak(ctx, u); }