Ticket #871 (closed todo: done)

Opened 13 years ago

Last modified 12 years ago

add 'rand' as a dynop

Reported by: coke Owned by: dukeleto
Priority: normal Milestone: 1.5
Component: none Version:
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

To support TT #189, we need to create a 'rand' dynop.

Suggested forms:

$N0 = rand     # generate a random float between 0 and 1
$N0 = rand $N1 # generate a random float between 0 and $N1

Might also want

srand $N0 # seed RNG.

If there is a RNG, any attributes for it should probably go into the Parrot Interpreter object.

Should be added to src/dynoplibs/math.ops

Change History

Changed 13 years ago by fperrad

Currently, in some languages (Lua, Markdown, WMLScript), I use these pure PIR libraries :

  • Math/Rand.pir
  • Math/Random/mt1997ar.pir

Before starting a new effort (dynop or other), Rakudo (and others HLL) could try these libraries.

Changed 13 years ago by coke

Those libraries are psuedo-random. The dynop would presumably take advantage of the system's entropy source.

This ticket was opened as a result of the discussion about options on TT #189.

Changed 12 years ago by allison

Agreed on the suggested forms. Once these 3 dynops are implemented, we can remove the Random PMC and close TT #189.

Changed 12 years ago by dukeleto

  • status changed from new to assigned
  • owner set to dukeleto

Changed 12 years ago by dukeleto

  • milestone set to 1.5

Changed 12 years ago by dukeleto

Since random became "eligible in 1.1", can it be removed for the 1.5 release? The addition of the random dynops is done.

Changed 12 years ago by coke

Yes, it can be removed now.

Changed 12 years ago by dukeleto

  • status changed from assigned to closed
  • resolution set to done

The rand and srand dynops have been added and the Random PMC is now a distant memory. A ticket for making the RNG pluggable has been created as #923 .

Note: See TracTickets for help on using tickets.